;

SQL CREATE TABLE


In this tutorial, we will learn how to CREATE TABLE using SQL.

SQL CREATE TABLE

SQL CREATE TABLE statement is used to create a new table in the existing SQL database.

Syntax - CREATE TABLE
CREATE TABLE tableName(
column1 datatype,
column2 datatype,
column3 datatype,
column4 datatype,
..
..
..
columnN datatype,
);

Here, Column parameter specifies the name of the column of the table.
And Datatype parameter specifies the type of data of the column such as integer, varchar, Date, DateTime, etc.

Example of  SQL CREATE TABLE

Example - CREATE TABLE
CREATE TABLE Employee(
ID int,
EmpName varchar(255),
City    varchar(255),
Country varchar(255),
Gender  varchar(255),
Salary  decimal(18,2)
);

Here, First Column ID is of type integer and will hold the integer value.
EmpName, City, Country, Gender columns are of type varchar and will hold characters and the maximum length of these columns is 255 characters.

And the "Employee" table structure will look like this:

Output - Table structure
ID EmpName City Country Gender Salary