Differences PRIMARY KEY VS UNIQUE in MySQL

Thursday, 05 February 2015 16:21
Print
User Rating: / 0
PoorBest 

So what's different from the PRIMARY KEY and UNIQUE CONSTRAINT?

 

1. PRIMARY KEY does not allow NULL in their fields, and UNIQUE - allow.

2. PK - there can be only one. UQ - can be any number.

3. When you create a PRIMARY KEY by default creates a clustered index, and when you create a UNIQUE not.