⟩ What is the difference between a primary key and a unique key?
- Primary key is a combination of columns which uniquely specify a row whereas a unique key is related to the superkey and can uniquely identify each row in the table.
- Primary can only be one in each table as it is one of the special cases of the unique key whereas a unique key can be many.
- Primary key enforces the NOT NULL constraint whereas unique key doesn’t. Due to this values in the unique key columns may or may not be NULL.