1.

Can you give differences for the Primary key and Unique key in SQL?

Answer»
PRIMARY keyUNIQUE Key
It is a unique identifier for each row of a table.It is a unique identifier for table ROWS in the absence of a Primary key.
A single Primary key is ALLOWED in a table.More than one Unique Key is allowed in a table.
NULL VALUE or duplicate value is not permitted.It can have a single NULL value but a duplicate value is not permitted.
When we define a Primary key, a clustered index is automatically created if it does not already exist on the table.When we define a Unique key, a non-clustered index is created by default to enforce a UNIQUE constraint.


Discussion

No Comment Found