We
can create Table in database in two different ways. In this Article I will how
to create Table in database (sql Server).
1.
Using Sql command:
Open SQL
server management studio and select Database name where you want to create
table. Now write following sql command:
Syntax:
CREATE TABLE table_name(
column1 datatype,
column2 datatype,
column3 datatype,
.....
columnN datatype,
PRIMARY KEY( one or more columns )
);
Example:
CREATE TABLE [dbo].[Student_info](
[Student_Id] [int] IDENTITY(1,1) NOT NULL,
[Student_name] [varchar](50) NULL,
[Age] [int] NULL,
[Class] [varchar](50) NULL,
[Is_delete] [bit] NULL,
[Rec_date] [date] NULL,
PRIMARY KEY(Student_Id)
);
2.
Second Method:
Open Sql server management studio. Expand
Database folder in Object explorer where you want to create table. right click on "Tables" and select New table option:
Now Add columns Name and Datatype(as per
requirement)
Now set Primary key in Table
Set Identity True i.e. Auto inreament
Now Save Table
Now Table"Employee" has been created. you can insert data in this table for further use.