CREATE TABLE books (
  bookid int NOT NULL AUTO_INCREMENT,
  title varchar(100) NOT NULL,
  author varchar(40) NOT NULL,
  genre varchar(50) NOT NULL,
  copy_available int NOT NULL,
  PRIMARY KEY (`bookid`)
 ) ENGINE=InnoDB;
 
CREATE TABLE users (
  userid int NOT NULL AUTO_INCREMENT,
  username varchar(50) NOT NULL,
  password char(64) NOT NULL,
  firstname varchar(50) NOT NULL,
  lastname varchar(50) NOT NULL,
  is_admin tinyint NOT NULL,
  PRIMARY KEY (`userid`)
 ) ENGINE=InnoDB;
 
 
INSERT INTO books (title, author, genre, copy_available) VALUES
('The Hunger Games', 'Suzanne Collins', 'Science Fiction', 3),
('System Collapse', 'Martha Wells', 'Science Fiction', 3),
('Eragon', 'Christopher Paolini', 'Fantasy', 2),
('Harry Potter', 'J.K. Rowling', 'Fantasy', 2),
('Dracula', 'Bram Stoker', 'Classic', 2),
('Twilight', 'Stephenie Meyer', 'Other', 3),
('Elon Musk', 'Walter Isaacson', 'Other', 2),
('PHP and MySQL for Dynamic Web Sites', 'Larry Ullman', 'Textbook', 5);

INSERT INTO users (username, password, firstname, lastname, is_admin) VALUES 
('janesmith', SHA2('jane88', 256), 'Jane', 'Smith', 0),
('bobsmith', SHA2('bob999', 256), 'Bob', 'Smith', 0),
('tom', SHA2('tom666', 256), 'Tom', 'O\'Reily', 1)
