SQL from Zero › Module 1: How a database thinks

DBMS and RDBMS

The software that runs a database, and why most of it today is relational.

Lesson 2 of 35 · about 10 minutes

Video: The librarian behind the library

The lesson

In the last lesson you met a short word: DBMS, a database management system. Let's open it up.

Think of the library again. The books on the shelves are the database: the data itself. The librarians, the catalogue and the rules about borrowing are the DBMS: the software that looks after the data. It stores it, finds it when you ask, stops two people from getting in each other's way, and keeps it safe if the power fails. You never touch the shelves directly. You always go through the librarian.

Early database software stored data in different shapes. Some kept it like a family tree, where every record had exactly one parent above it: the shop, then each author, then that author's books. That worked until data didn't fit the tree. Good Omens was written by Terry Pratchett and Neil Gaiman together, so it had to be copied under both authors, and copies can drift apart.

In 1970, a researcher at IBM called Edgar Codd suggested a simpler idea: keep all data in tables of rows and columns, and link tables together using shared values called keys. A table in this idea is called a relation, so this is the relational model. Software built this way is a relational database management system, or RDBMS.

customers.idnamecity
1EmmaLondon
2YukiTokyo
orders.idcustomer_idbook
1012Sapiens
1021Small Gods
1032Norwegian Wood

Orders 101 and 103 both say customer 2, so both are Yuki's. Her name is written only once, so it can never disagree with itself.

So what's the difference?

DBMSRDBMS
What it isAny software that manages a databaseA DBMS that stores data in linked tables
How data is shapedCould be files, trees, documents or tablesAlways tables of rows and columns
Links between dataNot always enforcedTables are linked with keys, and the links are checked
LanguageVariesSQL
ExamplesAny of the ones on the right, plus older or special-purpose systemsMySQL, PostgreSQL, Oracle, SQL Server, SQLite

The simplest way to remember it: every RDBMS is a DBMS, but not every DBMS is relational. Every square is a rectangle, but not every rectangle is a square.

Today, most business databases are relational. Your bank, airline bookings, online shops and payroll almost certainly run on an RDBMS. Some apps also use non-relational databases, often called NoSQL, such as MongoDB or Redis, for special jobs. This course is about relational databases, because that's where SQL lives.

Key ideas
  • A DBMS is the software that stores, finds and protects the data in a database.
  • An RDBMS is a DBMS that keeps data in tables linked by keys, and you talk to it with SQL.
  • Every RDBMS is a DBMS, but not every DBMS is relational. Most business databases today are relational.

Practise

Loading practice…

Quick check

1. What is a DBMS?

2. What makes a database “relational”?

3. Which of these is true?