Section 1 - Instruction

You've learned to query single tables, but real databases have multiple, related tables. How do we connect a customer to their orders, or link products to categories?

The answer is special columns called "keys" that keep data organized and connected. Think of keys as unique ID numbers that help tables communicate efficiently.

Engagement Message

What problems might arise if we can't uniquely identify database rows?

Section 2 - Instruction

A primary key is a column (or combination of columns) that uniquely identifies each row in a table. Think of it like a fingerprint - no two rows can have the same primary key value.

Like your social security number, no two rows can have the same primary key value.

Engagement Message

Can you think of what might be a good primary key for a "customers" table?

Section 3 - Instruction

Here's a simple customers table example:

CUSTOMERS

customer_idnameemail
1Sarahsarah@email.com
2Mikemike@email.com
3Lisalisa@email.com

Notice how customer_id is unique for each person? That's our primary key!

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal