Create Table

How to Create Table

Expand your Database (in my case its SqlServerTutorial)
Right Click on Table and click on New Table as shown below:




Now Add the columns and select your datatype.
Once you complete adding your columns and select all the datatype, click on "Save" or press Ctrl+S and enter you table name as shown below:


Now your table tblFaculty is created. If you want to edit the table right click on the table and click on Design.





I will create another table called tblStudent as shown below





Create Database using script

CREATE TABLE tblFaculty(
FacID int IDENTITY(1,1) NOT NULL,
FacName varchar(50) NULL,
Gender char(10) NULL,
AddrID int NULL,
FacAge int NULL,
 CONSTRAINT PK_tblFaculty PRIMARY KEY (FacID)

)




CREATE TABLE tblStudent(
StdID int IDENTITY(1,1) NOT NULL,
StdName varchar(50) NULL,
StdGender char(10) NULL,
AddrID int NULL,
FacID int NULL,
StdAge int NULL,
 CONSTRAINT PK_tblStudent PRIMARY KEY (StdID)
 )
adds below

No comments:

Post a Comment