Primary Keyis an unique attribute or set of unique attributes that can uniquely identify a tuple in a relation.
Primary key is auniqueandnot null attribute in a tuple. i.e. we cannot insert a tuple with blank or duplicate value in a primary key attribute.
Lets consider, a relation called emp
Emp_SSN | Emp_No | Emp_Name |
---|---|---|
1234544434 | E-001 | Pradipta Pal |
5345232444 | E-002 | Abhijit Ganguly |
4645673422 | E-003 | Suman Banerjee |
In the above relation called (Emp), Emp_SSN is a Primary Key. Here every Emp_SSN is unique and not null.
A Primary key is selected from a set of candidate keys. This is done by database admin or database designer. We can say that either {Emp_SSN} or {Emp_Number} can be chosen as a primary key for the table Employee.