In database world the term primary key and unique keys are very much known to all. Both the keys are used to uniquely identify rows in a table. They have similarities and at the same time they have some differences:
Following are some of the differences:
Following are some of the differences:
Primary key | Unique key |
---|---|
Primary key can't be null | Unique key can be null |
Primary key can be just one in a table | Unique key can be multiple in a table |
Primary key slightly faster than Unique key | Unique key slightly slower than primary key |
Primary key can span multiple fields in a table | Unique key can also be span to multiple fields in a table |
Comments
Post a Comment