Creating and working with table


The aim of this post is to create tblperson and tblgender tables and establish primary key and foreign key constraints.



Create a table from GUI

1. Expand the our database 























2. Right click on table option





















3. Fill Column Name, Data Type and Allow Nulls, as shown below and save the table as tblPerson.

1

Create table with Query. 

The following statement creates tblemployee table, with EmpId and name columns. EmpID column, is the primary key column.  Primary key does not allow nulls.

Create Table tblemployee 
(EmpId int Not Null Primary Key,
name nvarchar(50))