A unique identifier for each row in a database table, like a student ID number.
A primary key is a column (or columns) that uniquely identifies each row in a table. No two rows can have the same primary key value. Primary keys are required for databases to function—they allow you to reference specific rows and update/delete precisely.
Common primary keys are IDs (numeric or UUID), email addresses, or usernames. The database enforces uniqueness—it will not let you insert a duplicate. Primary keys are also the fastest way to look up rows. You define them using SQL CREATE TABLE statements.
Every table should have a primary key. When you create a table, you explicitly mark one column (or combination of columns) as PRIMARY KEY. Other tables reference this with foreign keys.
In modern databases like Supabase, primary keys are typically UUIDs — long random strings that are globally unique and more secure than auto-incrementing numbers.
Learn the concepts, fix things with confidence, and ship real products with AI beside you. No coding background required, and we're with you from the first idea to launch.
Free to start. No card. Leave whenever you want.