What is a database, really?
A database is a place where a program stores data in a neat, orderly way, so it can find that data again quickly and reliably later on. Almost everything you use day to day runs on one: your banking app knows your balance, a webshop knows which products exist and what you ordered, a booking system knows which seats are still free. All of that data lives in a database.
The best way to picture a database is as a collection of tables. A table looks like a sheet in a spreadsheet: it has columns (for example name, email, country) and rows (each row is one customer). One database usually holds several tables — say one for customers, one for products and one for orders — that together form a program's memory.
Why not just a spreadsheet?
A spreadsheet (like Excel or Google Sheets) is fine for a small list that one person updates now and then. But as soon as data gets serious, a spreadsheet hits its limits. A database is built for exactly those situations.
A database easily handles millions of rows, where a spreadsheet would grind to a halt. A hundred people can add and change data at the same time without overwriting each other's work. The database enforces the rules — for example that an email address may never be empty — so no mess creeps in. And you pull exactly the answer you want out of it with a single command, even from a mountain of data.
You give those commands in a language called SQL. Instead of scrolling through thousands of rows yourself, you ask the database a question — 'give me all customers from the Netherlands who bought something this month' — and get the answer back. That language is what you learn in this course.
SELECT name, email FROM customers WHERE country = 'NL';
Above you get an early look at what a question to a database looks like. You don't need to be able to write this yet — just notice how readable it is: 'pick the name and email columns from the customers table, but only where the country is NL'. That is the whole idea behind SQL: you describe *what* you want to know, and the database finds it for you.
- Think of an app or website you use often (a webshop, a social network, your bank).
- Write down which data you think it has to remember. Which tables would you expect? (Think: users, messages, orders, products.)
- For each table, come up with a few columns. What does the app know about one user or one order?
- Keep this list. Later in the course you will query exactly these kinds of tables, and even build them yourself.
Stuck?
- Is a database the same as a server? No. A server is the computer; the database is the software that manages the data on it. They often run together, but they are different things.
- Do I need to install anything now? Not yet. In this module you learn the concepts. In lesson 1.3 we point you to a free practice environment for when you want to type along.
- I know Excel well — is that a disadvantage? Quite the opposite. Everything you know about rows, columns and filtering helps you here. SQL is the more powerful, precise version of that same idea.
- In your own words, what is a database, and what does a table consist of?
- Name two things a database does better than a spreadsheet.
- What do you do with the SQL language?