Distinguish, differentiate, compare and explain what is the main difference between Primary and Unique key in database programming. Comparison and Differences.
Difference between Primary and Unique key
1 There is only one Primary key for a table. There may be more than one Unique Key for a table.
2 Primary Key can’t contain a NULL value. Unique Key can contain only one NULL Value per column in a unique index column in SQL Server and DB2 (in Oracle Unique Key can have any number of NULL per column).
3 Primary Key creates a clustered index by default. Unique key creates a unique non-clustered index by default.