Question · SQL and MySQL course · Module 9: Indexes and normalization

Difference between PRIMARY KEY and UNIQUE

How does PRIMARY KEY differ from a UNIQUE INDEX?

Answer options

  • PRIMARY KEY is one per table and does not allow NULL; UNIQUE can be many and allows NULL values
  • There is no difference - they are two words for the same thing
  • PRIMARY KEY allows duplicates, while UNIQUE does not
  • UNIQUE must be one per table, while PRIMARY KEY can be many

You can check the correct answer by solving this task in the CodeWorlds game.