Wednesday, 18 January 2012

Explain PRIMARY KEY constraint in SQL Server.

The PRIMARY KEY ,

• is used to uniquely identify the records in a table.

• it should not contain NULL values.

• each table should have a PRIMARY KEY.

• each table can have only one PRIMARY KEY.

Ex :

Create Table Suppliers

(

Supplier_ID int NOT NULL PRIMARY KEY,

Supplier_Name varchar (300) NOT NULL,

Address varchar (500),

City varchar (200)

)

This Query creates PRIMARY KEY on the “Supplier_ID” column in suppliers table.

Labels:


Bookmark this Blog in your Favorites

3 Comments:

Blogger microsoft certifications said...

I can see that you are are genuinely passionate about this! I am trying to build my own website and youve helped me with some great information
http://www.sqlservermasters.com/

20 May 2013 at 23:39  
Blogger Unknown said...

Thanks for the interesting read!

best gadget reviews

29 June 2013 at 09:20  
Blogger Unknown said...

Interesting! thanks for sharing this explanation guide in Primary Key. Looking forward for your next post.





Server Racks | Racks And UPS


13 August 2013 at 17:17  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home