Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing
Back
  1. Home
  2. Interview prep
  3. What is a primary key?

SQL · Keys, Schema & CTEs

What is a primary key?

Easysql-36
primary keyconstraints

Question

What is a primary key?

Solution

A primary key uniquely identifies each row.

CREATE TABLE customer (
    id INT PRIMARY KEY
);

Properties:

  • Unique
  • Cannot be NULL
  • Usually indexed

🎯 Put this concept into practice

Solidify this answer with real hands-on interview drills in the browser studio.

Open related drill →
PreviousNext