SQL 2: Table Creation In SQL Server/Database Management System

database consist of Tables, a table contain rows and columns, Columns contains the related information of specific item. A row contains columns information.

In database, columns are also known as "field" and rows as "Records".
Before starting with the article, please read the previous article of the series:
SQL 1- How to Create Database In Microsoft SQL Server

Lets create our first database which will contain one table with the name "Users_Table".
  • Open SQL server that you have installed on your machine. The first screen looks like this.

  • Enter your server name and the click on "connect".
  • After connecting your database engine right click on Databases in the object explorer.

  • Enter your new database name, suppose we are creating our database with the name "User_Registration".

  • Under the databases folder our new database is created with the name "User_Registration".

  • Expand the User_Registration database in which our database contains the folder "Tables".

  • Right click on Tables and click on Table to create new table.
  • Now enter the desired column name under which you want to store your data.

  • Here we created four columns. These columns will contain related data with the name specified.

  • Whenever you create the table you must put first column for "id" and set "Primary Key" on id by right clicking on the id. id is a unique identifier because we set "Primary Key" on it which identify each individual record or row in a table.
  • id should have a data type integer (int).
  • Notice that other columns field contain data type "varchar(50)". varchar specify that every type of data can be input in the field either numeric values or either alphabetic values.
  • Where 50 is the size of field. It can contain 50 characters.
  • One more important thing to be noticed that at a time when you set primary key on the id there must be auto increment on id. There is "columns properties" on the bottom.
  • Click on "U_id" & in the column properties there is "identity specifications". Expand"identity specification" and set (is identity) to "yes".

Identity Specification:

This will increment in the id automatically whenever you enter individual record.

Identity Seed:

Identity seed is the option where you can provide your desired initial number from where you want to store record.

Identity Increment:

Identity increment is the option where you set a value that tells how much increment you want in every record.

Here we start storing record in U_id with a initial value of 1 which we specify in identity seed and we put a increment of 1 in the User_id.
  • Last step is to save the table with the desired name. By pressing Ctrl+S we save it with the name"Users_Table".