What Is a Database?
Objectives
By the end of this lesson, you should be able to:
- Explain what a database is, in plain terms
- Explain why a database is usually a better choice than a plain file or spreadsheet
- Describe, at a high level, what “querying” data means
💡 Why this matters: Every term and every tool in this course exists to solve one problem: storing data so it can be found, trusted, and changed safely, at any size. Understanding that problem first makes every tool that follows make sense.
Data That Needs a Home
Almost every application needs to remember things between visits: a shopping site remembers what’s in stock, a bank remembers account balances, a bookstore remembers its customers and orders. That information has to live somewhere, in a form the application can reliably read back later.
A database is an organized collection of data, stored so it can be efficiently added to, searched, updated, and removed. That’s the whole definition. A single text file full of names is technically “data,” but it’s not organized in a way that makes searching or updating it safe and fast, which is exactly the gap a database fills.
Why Not Just a Spreadsheet or a File?
A spreadsheet or a plain text file works fine for small, personal, single-user data. It starts to break down once real requirements show up:
- Multiple people need to use it at once. Two people editing the same spreadsheet at the same time risk overwriting each other’s changes.
- The data needs to stay correct. Nothing stops a spreadsheet from having a price typed in as text instead of a number, or an order pointing at a customer who doesn’t exist.
- It needs to be fast at a large size. Searching a spreadsheet with ten rows is instant. Searching one with ten million rows, by hand or with basic tools, is not.
- Different pieces of data relate to each other. An order belongs to a customer and contains books, a spreadsheet has no real way to express that connection, only to repeat data or hope nothing gets out of sync.
A database is built to handle exactly these problems: many users at once, rules that keep data correct, fast lookups even at a large scale, and real relationships between different kinds of data.
Asking a Database Questions
Once data lives in a database, you don’t dig through it manually, you ask it a question and it gives you back exactly the answer. That question is called a query. “Which customers signed up this year?” or “How many books are in stock?” are both queries, in plain English. The rest of this module, and this entire course, is about writing those questions in a language a database actually understands.
Try It
No database yet, this lesson is about the concept.
- In your own words, explain the difference between “a collection of data” and “a database.”
- Think of an app you use often (a messaging app, a shopping app, a music app). Name two different pieces of data it almost certainly stores in a database.
- For the app you picked, describe one problem that would happen if it stored all its data in a single plain text file instead of a database.
Recap
- A database is data organized so it can be added to, searched, updated, and removed reliably.
- Spreadsheets and plain files struggle with multiple simultaneous users, keeping data correct, performance at scale, and expressing relationships between data.
- A query is a question asked of a database, in a language it understands.
Next lesson: the software that actually runs a database, a DBMS, and the specific kind this course is built around, an RDBMS.