Loading Depth Study
Preparing your workspace
A primary key uniquely identifies each record within a relational table.
Applications need to refer to specific records reliably. A primary key provides a unique identifier for each row and should remain stable enough for the application's needs. Common choices include numeric IDs and UUIDs. Primary keys also provide the foundation for relationships between tables because other tables can reference them.
A users table can use a UUID or numeric ID as the primary key, and an enrollments table can store that ID to identify the user.
CREATE TABLE users ( id uuid PRIMARY KEY, name text NOT NULL );
The id column uniquely identifies each user record.