A primary key is a unique identifier for each row in a relational database. It ensures that no two rows share the same value and is used to support indexing, fast lookups, and relationships between tables. Primary keys can be integers, UUIDs, or composite keys involving multiple columns.
Why it matters
Primary keys maintain data integrity and make it possible to reference specific records using foreign keys. They are essential for normalization, query performance, and well-designed schemas.
Examples
User IDs, order IDs, and invoice IDs are commonly implemented as primary keys. Lessons like Primary Keys and IDs cover these concepts.