Thursday , December 14 2017
Home / DataBase / SQL SERVER / How to Create A Table

How to Create A Table

       Definition of Table:- A Table is an object Used to Store data in Rows and Columns Formate.A Single Table Stores information about a particular topic, Such as customers,products, or orders etc.

     In Sql Server, Tables can be created graphically or using a query.

1.Graphically and

2.using a query

1.Graphically :-

Expand Databases -> Expand Database(What ever you created) -> Right Click on Tables-> Select New Table…->                    Give  Columns Names in Column Name Column and Give Data Type to Appropriate Datatype to related column. If you Want to allow nulls then check Allow Nulls Column fields or else Uncheck  Allow Nulls Column fields.

2. using a query:-  We can also Create a Database using a Query, The SQL CREATE TABLE statement allows you to create and define a table.

1.Take New Query Window editor then

2. Write a query in that window


CREATE TABLE table_name
                              column_name1 data_type(size),
                              column_name2 data_type(size),
                             column_name3 data_type(size),


Parameters or Arguments

table_name:-    The name of the table that you wish to create.
column_name1, column_name2, column_name3  :-       The columns that you wish to create in the table. Each column must have a datatype. The column should either be defined as NULL or NOT NULL and if this value is left blank, the database assumes NULL as the default.



Let’s look at a SQL CREATE TABLE example.

This SQL CREATE TABLE example creates a table called Employee which has 3 columns.

  • The first column is called Employee_id  which is created as a number datatype (maximum 10 digits in length) and can not contain null values.
  • The second column is called Employee_name which is a char datatype (50 maximum characters in length) and also can not contain null values.
  • The third column is called contact_name which is a char datatype but can contain null values.

then Refresh the Databases Folder you will see Database name what ever you creates here you will see Database name Sample in Databases Folder.



Print Friendly, PDF & Email

Give us your valuable feedback


About Samba

Check Also

sql server backup script

Backup all databases in SQL Instance with one script

Backup: A copy of SQL Server data that can be used to restore and recover the …

%d bloggers like this: