Distinguish, differentiate, compare and explain what is the main difference between Primary Key and Unique key in database programming. Comparison and Differences.
Difference between Primary Key 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 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 clustered index by default. Unique key creates a unique non-clustered index by default.