Module 51: Introduction to Databases
Files, spreadsheets and databases
🏠The everyday picture
A notebook, a filing cabinet and a library. All store information. Only the library has a catalogue, a librarian, rules for borrowing, and a way to find any book in seconds.
📘What it really is
-
Files (like JSON or CSV): simple, readable, good for configuration, exports and small data. But the whole file is usually read and rewritten for every change; two writers can overwrite each other (Module 43); no rules are enforced; finding things means reading everything.
-
Spreadsheets: excellent for people exploring and calculating by hand. But they mix data with formatting, allow any value in any cell, struggle with relationships between sheets, and aren't built for many programs writing at once.
-
Databases:
- store data in a structured, enforced way (types, required values, relationships);
- change only what's needed, safely, even with many users at once;
- answer questions quickly using indexes (Module 57);
- protect against partial changes with transactions (Module 57);
-
control access with users and permissions (Module 58).
-
Data often moves between them: exported from a database to a spreadsheet for a report, or imported from a CSV into a database. Knowing each one's strengths matters.
🖱️Try it
Start the Level 5 assignment: create a spreadsheet of 20 customers (name, phone, city, joined date). Then enter a phone number as text in one row, a date in the wrong format in another, and a duplicate customer. Notice that the spreadsheet accepts all of it. (Use an AI to generate realistic fake data; never use real people's details for practice.)
✅Quick check
Why do two programs writing to the same JSON file risk losing data?
Show the answer
Each reads the whole file, changes it and writes it back; one can overwrite the other's change.
What does a spreadsheet do when you type text into a column meant for dates?
Show the answer
Usually accepts it, so bad data gets in. A database can refuse it.
