SQL Table

SQL Create Table

Once database is created, we can start to create the required tables that would contain all the informations.


In SQL, CREATE TABLE statement helps you to create a new table in database.

To create a table, we need to:

  • name the table appropriately
  • define the coloumns that the table will have,
  • define the datatype of each column


CREATE TABLE  table_name (
coloumn1  datatype,
coloumn2  datatype,
coloumn3  datatype,


coloumnN  datatype


Suppose we want to have a table for our site tutorials in hand, named tih_Courses having Course_ID, Course_Name, Professor andMode_of_Training offered.

We will write create statement as shown below:

CREATE TABLE tih_Courses (
Course_Name VARCHAR(30),
Professor   VARCHAR(25),
Mode_of_Training   VARCHAR(20)

An empty table with the name tih_Courses will get created as shown below:

Course_ID Course_Name Professor Mode_of_Training

Data each coloumn holds

Data types such as int, varchar, etc defines the type of value that the particular coloumn can hold.

Course_ID → INT represents that couse id should only allow integer value.

Course_Name → VARCHAR indicates that it holds character value. 30 indicates the maximum length allowed.

Professor → VARCHAR indicates that it holds character value. 25 indicates the maximum length allowed.

Mode_of_Training → VARCHAR indicates that it holds character value. 20 indicates the maximum length allowed.


What you can do with this table?

  • You can insert data in this table using sql INSERT statement.
  • You can update the table data as per requirement using sql UPDATE statement.
  • You can rename the table using sql RENAME.
  • You can delete the table using sql DELETE statement
  • You can drop the table using sql DROP statement
  • You can apply constraints as well for particular coloumn such as NOT NULL, make it primary key 

Please Share this page
Views : 149
Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!