SQL Server – Create table statement and sql syntax

Database table is used to store data in column and rows format. Each table has its own name.

Create Table Statement

Using create table sql statement you can create a table inside your database.

Note: Maximum number of column in table is 1024

CREATE TABLE table_name
column_name datatype(size),
column_name datatype(size),
column_name datatype(size)….

Here, you can give any table name but it should not start with special character accept underscore.


column_name – Specify the name of the column inside table

datatype –  Type data column can hold inside table, some of common datatype available in SQL Server (eg. Int, char, varchar, decimal, date, datetime)

(size) – Maximum length of data can be in the column

Read more about Datatype of SQL Server


Lets go through simple example to create simple table called CustomerDetails

Create table statement

Simple example of creating table

Here,  CustomerID can hold only Integer value and other three columns can hold string value ( it can be character or number or combination of character + number)

SELECT query against table

If you execute SELECT query against CustomerDetails, There will be no result because nothing is stored.

Note : To insert records in table you can use INSERT INTO statement, Read more about INSERT INTO statement

Leave a Reply




6 − = 3