Creating database and table #

I will suggest you phpmyadmin because it’s easy and you can follow the video. If you don’t have phpmyadmin or you want to this using mysql CLI then here I am sharing all the commands.

Creating database #

First of all we need to create a database, named crud.

    CREATE DATABASE crud;

Change current database #

You have to change the current database to crud, so that all query will run in context of crud database.

    use crud;

Create Table #

Now we will create the table, here is the query for creating table. SQL query is very easy and it’s easy to understand. I hope you know little bit of SQL as it is prerequisites of this course.

    CREATE TABLE `product` (
    `id` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY ,
    `name` varchar(32) NOT NULL,
    `price` int(11) NOT NULL,
    `description` varchar(512) NOT NULL
    );
FieldTypeNullKeyDefaultExtra
idint(11)NOPRINULLauto_increment
namevarchar(32)NONULL
priceint(11)NONULL
descriptionvarchar(512)NONULL
comments powered by Disqus