MySQL Tools Comparison.

  • Increase font size
  • Default font size
  • Decrease font size
Home Blog MySQL Differences PRIMARY KEY VS UNIQUE in MySQL

Differences PRIMARY KEY VS UNIQUE in MySQL

Print PDF
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.