SQL CREATE TABLE Statement

A table is primarily a list of useful items or a group of lists and to manage such list it should be organised. To organise this information it is divided into rows and columns. To create a table Data Definition Language (DDL) command is used which is CREATE TABLE followed by table name. Therefore to create a table you start with following statement.

CREATE TABLE

CREATE TABLE TableName

where CREATE TABLE is DDL command and TableName is name of the table which you are creating.

Below is an example of how to create a table.

CREATE TABLE Syntax

CREATE TABLE TableName
(
ColumnName1 DataType(size),
ColumnName2 DataType(size),
ColumnName3 DataType(size),
.
.
.
ColumnNameN DataType(size)
)

CREATE TABLE Example

CREATE TABLE Student
(
 RollNumber INT,
 Title VARCHAR(8),
 FirstName VARCHAR(50),
 MiddleName VARCHAR(50),
 LastName VARCHAR(50),
 City VARCHAR(50),
 Country VARCHAR(30)
)

You can also refer article How to Work on Tables in detail.

CLICK HERE to watch live practical.

Reference: Manzoor Siddiqui [www.SQLServerLog.com]

You may also like

You may also like...

Leave a Reply