What a relational database is, explained with a small shop
A relational database keeps each kind of thing in its own table (customers, products, sales) and links the tables by an ID, so a customer’s address is typed once and every sale points at it. The database refuses a link to a record that does not exist, which a spreadsheet of lookups cannot do.
30 October 2026 · 4 min read
Tables, records and fields
A small shop has customers, products and sales. In a relational database each gets a table. Each row is a record (one customer), and each column is a field (the customer’s name, email, postcode). Every record has a primary key, usually a number, that never changes and is never reused, so it can be pointed at even if the name is corrected.
Linking tables
A sale needs to say who bought. Rather than copying the customer’s name and address into the sale, the Sales table has a Customer field holding that customer’s ID. That field is a foreign key: it points at a record in another table. One customer can have many sales, which is called a one-to-many relationship.
A sale can contain many products, and a product appears in many sales. That many-to-many link is made with a table in between, Sale Lines, where each line points at one sale and one product and holds the quantity and price. Most real databases are built from chains like this.
Why bother
- Typed once. A customer moves house; you change one record, and every sale shows the new address.
- Checked. The database refuses a sale line pointing at product 412 when there is no product 412. This is called referential integrity, and it is the thing a spreadsheet full of VLOOKUPs cannot promise.
- Cleaned up. A relationship can say that deleting a sale deletes its lines too, or that a customer with sales cannot be deleted at all.
- Questions across tables. A query can join sale lines to products and answer “what were our best sellers this month” in one step.
Where you will meet one
Microsoft Access and LibreOffice Base are desktop databases that keep a file on your own computer. SQLite is the engine inside countless phone apps and programs. MySQL, PostgreSQL and SQL Server run on servers for many people at once. They differ in size and setup, but tables, keys and relationships work the same way in all of them.
Our own product, disclosed
Where our own software comes into this
We make Rutba Office, a free desktop suite for Windows, and its Data Files app is a desktop database of this kind. The film below relates a shop’s tables: each sale points at one customer, each sale line at one sale and one product, and a sale’s lines go with it if it is ever deleted. Afterwards the lines show product names rather than numbers, and a line pointing at a product that does not exist is refused.
Related
A free database for a small business, and how to tell you need one
You need a database rather than a spreadsheet once the same customer, product or job is typed into more than one place. Microsoft Access, LibreOffice Base and the SQLite tools keep the records on your own computer for little or nothing; online tools such as Airtable keep them on their servers.
How to start learning SQL on a small database of your own
Practise on a copy of a small database you understand, using only SELECT at first: choose the fields, the table, a WHERE condition and an ORDER BY. DB Browser for SQLite, the SQL view in Access and LibreOffice Base are free or already installed places to do it, and a read-only habit means nothing can be broken while you learn.
How to work on PostgreSQL or MySQL tables from a desktop database
Keep the records in the server and point a desktop program at its tables. Access does it with linked tables through an ODBC driver, LibreOffice Base connects directly, and tools such as DBeaver edit tables as a grid. Give the program an account of its own with only the rights it needs.
Thirteen apps, one free download
No account, no telemetry, and it works with the network switched off.