A relational database is a structured collection of data organized into tables, where each table represents a specific entity and relationships between entities are defined through shared key values. This model was formally proposed by E.F. Codd in 1970 and has since become the dominant paradigm for data storage in enterprise systems worldwide.
At its core, a relational database stores data in rows and columns. Each table (also called a relation) has a fixed set of columns called attributes, and each row represents a single record or tuple. For example, a table called Customers might have columns for customer ID, name, email, and registration date. Every row in that table is one customer's record.
The power of the relational model comes from its ability to connect tables through keys. A primary key is a column (or combination of columns) that uniquely identifies each row in a table. A foreign key is a column in one table that references the primary key in another table, creating a logical link between the two. This linking mechanism allows data to be stored once and referenced many times, eliminating redundancy and ensuring consistency.
Relational databases are managed by software systems called Relational Database Management Systems (RDBMS). Popular RDBMS platforms include PostgreSQL, MySQL, SQLite, Oracle Database, and SQL Server. Despite their differences in features and syntax, all of them follow the relational model and support SQL as their primary query language.
Unlike flat-file systems such as spreadsheets, relational databases enforce rules called constraints that prevent invalid data from being entered. These constraints — such as uniqueness, not-null requirements, and referential integrity — make relational databases far more reliable for production applications.
Understanding the relational model is the essential first step before writing a single line of SQL. Every query you write, every table you design, and every relationship you define will be grounded in these foundational concepts.
A regional logistics company manages shipments, drivers, and delivery routes. Instead of storing all this information in one massive spreadsheet, they use three separate tables: Drivers, Shipments, and Routes. The Shipments table contains a foreign key referencing the Drivers table, and another foreign key referencing the Routes table. This structure means that when a driver's contact information changes, it only needs to be updated in one place — the Drivers table — and the change is automatically reflected across all shipments assigned to that driver.
- A relational database stores data in tables made up of rows and columns.
- Primary keys uniquely identify each row; foreign keys link tables together.
- RDBMS software (PostgreSQL, MySQL, Oracle, SQL Server) manages and enforces the relational model.
- Constraints prevent invalid data and maintain data integrity.
- The relational model eliminates redundancy by allowing data to be stored once and referenced many times.