How To Create New Tables

We have named our database “CSC”, so now let’s create a table with this database that stores information of the students.

Now select the CSC database, in the left side panel and navigate to SQL tab,

Syntax for creating a table,

CREATE TABLE [IF NOT EXISTS] table_name (list_of_table_columns)

The sections in bracket (“[” and “]”) are optional. The “IF NOT EXISTS” option forces the table creation to abort if there is already a table with the same name. It is important to use this option to avoid getting an error if the table is already created.

Let’s create our table:

CREATE TABLE IF NOT EXISTS student (
enroll_no int(5) NOT NULL,
Student_name varchar(25) DEFAULT NULL,
gender varchar(6) DEFAULT NULL,
course varchar(6) DEFAULT NULL,
total_fees int(5) DEFAULT NULL)