Relational Databases
How Tables and Keys Store Related Data
What is a relational database? A relational database stores data in tables and links related tables through shared key values. The model is based on the mathematical idea of a relation, which is what each table represents.
Edgar F. Codd proposed the model in 1970, and it remains the most widely used approach for business and web data. Each table describes one type of entity, such as customers, products or orders. Columns define the attributes, and rows hold the individual records.
Relationships are expressed through keys rather than by copying data. An orders table might store only a customer ID, not the customer's name and address. When both are needed, the database combines the two tables using that ID. These links rely on primary and foreign keys, and information stays in one place, so a change of address has to be made only once.
Structured Schemas, SQL and Data Integrity
A relational database uses a fixed structure, called a schema, that declares each table's columns and data types before data is stored. The DBMS checks every new row against that structure. A numeric price column cannot accidentally hold a word, and an order cannot point to a customer who does not exist.
Most relational databases are queried with SQL, short for Structured Query Language. SQL lets applications and administrators read data, add records, update values and delete rows. The language is standardized, so many systems understand the same core commands.
Relational systems also typically support transactions, which group several changes into one unit that either completes fully or not at all. This matters for orders and payments, where a half-finished update could leave stock and invoices out of step.
A Relational Database in a Small Shop
Consider a small online shop. The customers table has one row per customer, the products table has one row per item for sale, and the orders table has one row per purchase. Each order refers to a customer and a product by their IDs. When the owner asks for every order placed by one customer in March, the database follows those links and returns the answer without repeating names or descriptions across thousands of order records.
Frequently asked questions
Which databases are relational?
Common relational database management systems include MySQL, MariaDB, PostgreSQL, Microsoft SQL Server, Oracle Database and SQLite. They share the table-and-key model and use SQL, although each has its own extensions and differences in detail.
Is a relational database always the better choice?
No. Relational databases suit data with a clear structure and strong relationships, such as accounts and orders. A NoSQL database can fit better when data is very large, loosely structured or changes shape often. The right choice depends on the workload, as explained in SQL vs NoSQL databases.