Create the books table
Next, we need somewhere to store our books. Add the following SQL below the students table:
sql
CREATE TABLE IF NOT EXISTS books (
book_id INT AUTO_INCREMENT PRIMARY KEY,
book_title VARCHAR(50) NOT NULL,
book_author VARCHAR(100) NOT NULL,
book_category VARCHAR(50) NOT NULL,
book_created_at TIMESTAMP NOT NULL
DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB
DEFAULT CHARSET=utf8mb4
COLLATE=utf8mb4_general_ci;
text
books
├── book_id
├── book_title
├── book_author
├── book_category
└── book_created_at
students and books have their own primary key.
These IDs will later be used by the borrow table.
Sign in to save your progress permanently.
Progress is saved in your browser session
Step 6 of 19