A primary key is used to ensure data in the specific column is unique. It is a column cannot have NULL values A column with a unique key constraint can only contain unique values – this is the result of the unique key prohibiting duplicate values to be stored inside a column. Please keep in mind that it’s not mandatory to have a Unique key in a tableWhat is Primary Key?
What is Unique Key?
Primary Key | Foreign Key |
---|---|
It is used to uniquely identify data in the table | It is used to maintain relationship between tables |
Eve | Jackson |
It can’t be null | It can accept the null values |
Two or more rows can’t have same primary key | It can carry duplicate value for a foreign key attribute |
Primary has clustered index | By default, It is not clustered index |
Primary key constraint can be defined on temporary tableindex | It can’t be defined on temporary tables |
No comments:
Write comments