primary key
The column, or columns, whose value uniquely identifies each row of a table and can never be NULL.
In more detail
The database refuses a second row with the same primary key value, and other tables point at a row through it. Many databases and object-relational mappers can generate the value automatically; in SQLite, for example, a single column declared INTEGER PRIMARY KEY is filled in on insert.
Examples
EF Core treats a property named Id as the primary key by convention.In the browser: In IndexedDB the key path names the property used as the key, such as keyPath: 'id'.@Id private String id;id INTEGER PRIMARY KEYRelated terms
- table — A named set of rows that all have the same columns, where each row records one fact about one thing.
- entity — A thing in an application's domain with its own identity, such as a user, account or product, usually stored in a database.
- foreign key — A column holding another table's primary key value, which the database guarantees points at a row that exists.
- object store — The IndexedDB equivalent of a table: a named collection of records, each found by its key.
- index — A separate, sorted structure a database keeps alongside a table so it can find matching rows without reading them all.
- identifier — A name or number that picks out exactly one thing, such as one container, one image or one database row.
- JPA entity — A class marked @Entity whose instances JPA stores as rows in a table, identified by a field marked @Id.
- relational database — A database that stores data in tables and links rows in one table to rows in another through shared key values.
- composite key — A key made of two or more columns together, such as order and product on an order line.
- unique constraint — A constraint that no two rows may have the same value in a column or combination of columns.
Taught in
- Entity Framework Core: Code First and Migrations — Modern .NET Core, C# & Enterprise Microservices
- IndexedDB In Practice: Object Stores, Indexes And Transactions — Frontend Architecture & Web Platform
- Persistence With JPA And Hibernate — Modern Java: Virtual Threads & High-Throughput Services
- Why Tables And Relations Beat Files — PostgreSQL, Indexing & Relational Data Modeling
- Keys, Constraints And Referential Integrity — PostgreSQL, Indexing & Relational Data Modeling
- Inserting Data Safely — PostgreSQL, Indexing & Relational Data Modeling