Solve “Deduplicate events with ROW_NUMBER”

Free. Runs in your browser, no install.

SQL · Keys, Schema & CTEs

What is a primary key?

Easyprimary keyconstraints

Interview question

What is a primary key?

How to answer

The short answer

A uniquely identifies each row.

SQL
CREATE TABLE customer (
    id INT PRIMARY KEY
);

Properties:

  • Unique
  • Cannot be NULL
  • Usually indexed

Lock it in with a real drill

You remember an answer longer once you have used it. Try a hands-on problem on this concept.

Open related drill