Trongate Website Homepage

Creating A Books Database Table

Now, we're going to start the process of manually building a 'books' module. For us, this process starts with building a simple database table. Below is a three minute video, showing you precisely how to do this. For those in a hurry, the SQL code for creating our 'books' database table is available at the bottom of this page.

[youtube]{
"headline": "Video Demo",
"info": "In this video I'm going to demonstrate how to create a database table for our books records.",
"videoId":"F4YGqSXXQRk"}
[/youtube]

'Books' Table SQL

Below is the SQL code required for creating the 'books' database table:


CREATE TABLE `books` (
  `id` int(11) NOT NULL PRIMARY KEY AUTO_INCREMENT,
  `title` varchar(255) NOT NULL,
  `description` text NOT NULL,
  `author_id` int(11) NOT NULL,
  `published` tinyint(1) NOT NULL
);