Skip to main content
2 of 8
added 158 characters in body
RolandoMySQLDBA
  • 184.3k
  • 33
  • 323
  • 531

You cannot name a PRIMARY KEY. The name PRIMARY KEY is the designation of the preferred unique index (candidate key) for accessing the table. A table can have multiple unique keys.

EXAMPLE: Employee table with three unique keys

  • EmployeeID
  • Driver's License Number
  • Social Security Number

You can create a unique index without it being the PRIMARY KEY as follows:

create table a (foo INTEGER, UNIQUE KEY foo_id (foo)); 

Check these other links about PRIMARY KEYs vs Unique Keys

RolandoMySQLDBA
  • 184.3k
  • 33
  • 323
  • 531