juniorSQL

What is a primary key?

Updated May 17, 2026

Short answer

Primary key uniquely identifies each row.

Deep explanation

It enforces uniqueness and cannot be NULL.

Real-world example

User ID in a user table.

Common mistakes

  • Using non-unique columns as primary key.

Follow-up questions

  • Can a table have multiple primary keys?
  • Can primary key change?

More SQL interview questions

View all →