Wednesday, October 17, 2012

Primary Key Constraint

Posted by Rahul Kharde at 11:30 AM
  • Primary key constraint is used to uniquely identify each record in database table. 
  • It won’t allow repetition or duplication of data
  • Every table should have a primary key constraint to uniquely identify each row.
  • Each table is having only one primary key constraint and it contains only unique values.
  • Primary key constraint doesn’t accept null values

Example

Here is the syntax to define EID attribute as a primary key in a Employee table.

CREATE TABLE Employee
(
            EID INT PRIMARY KEY IDENTITY NOT NULL,
            ENAME VARCHAR(50),
            SALARY DECIMAL(10,2),
            DEPT VARCHAR(50)
)




If you enjoyed this post and wish to be informed whenever a new post is published, then make sure you subscribe to my regular Email Updates. Subscribe Now!


Kindly Bookmark and Share it:

YOUR ADSENSE CODE GOES HERE

0 comments:

Have any question? Feel Free To Post Below:

 

Popular Posts

Recent Comments

© 2011. All Rights Reserved | Help to understand .Net | Template by Blogger Widgets

Home | About | Top