Topic
Relational databases
A relational database organizes data into tables and supports operations that relate records across them.
At a glance
- Record identity
- Primary key
- Relationship constraint
- Foreign key
Overview
A relational database organizes data into tables and supports operations that relate records across them. Keys identify records and connect related data, while constraints express rules that the database can enforce independently of the application interface.
Tables and relationships
A table groups records with defined columns. A foreign key connects a value to an identified record in another table, allowing relationships to be checked rather than merely assumed by application code.
Design around the workload
The schema should reflect the data's meaning and the operations it must support. Queries can combine tables, while indexes and constraints serve different purposes: access efficiency and data integrity.
Sources and review
MOOR's explanatory text is supported by the following source links.
- Relational database concepts — PostgreSQL
- Constraints — PostgreSQL