1. Primary keys cannot contain null values. Unique key treats NULL as a value
2. A table cannot have more than one primary key on columns. A table can have multiple unique columns
3. Primary key is used on referential integrity whereas Unique key can't be used for relational integrity
Interviewers ask you the difference between primary key and not-null unique key constraint
Expected answer: Primary key is used in referential integrity to define entity relationship. ( Functional dependencies )
2. A table cannot have more than one primary key on columns. A table can have multiple unique columns
3. Primary key is used on referential integrity whereas Unique key can't be used for relational integrity
Interviewers ask you the difference between primary key and not-null unique key constraint
Expected answer: Primary key is used in referential integrity to define entity relationship. ( Functional dependencies )
Comments