Part 3 of 6 · 3 min read
What a database management system actually gives you
The four concrete things a DBMS provides that plain files do not.
Think of a librarian standing between every reader and the shelves. A reader never walks up to a shelf and moves books around directly. The reader asks the librarian, and the librarian enforces the rules: one card per book, a book cannot be checked out twice, a damaged book gets flagged before it goes back on the shelf.
In plain words: a database management system sits between an application's code and the data the same way. A program never touches the stored bytes directly. It asks the DBMS for what it wants, in a language the DBMS understands, and the DBMS is the only thing that actually reads or writes the files underneath. Because every program goes through the same gatekeeper, the DBMS can enforce rules no single program could enforce on its own.
A worked example. The bookstore's address problem from part 1 does not happen inside a DBMS, because the customer's address is stored exactly once, in one table, and every order simply points at that customer's row instead of copying the address into itself. Moving house becomes one update, in one place, and every order automatically shows the new address the next time anyone looks, since nothing but a reference was ever duplicated.
The key lines. A plain-file program reads and parses customers.txt by hand to find one customer. A DBMS is asked instead, in SQL, a language later modules explain in full:
SELECT address FROM customers WHERE customer_id = 107;
Database management system (DBMS)
A database management system is software that sits between every application and the data it stores. It owns the data, exposes a query language as the only way in or out, and enforces three things no single application is ever trusted to enforce alone: integrity constraints (the rules a value must satisfy to be stored at all), atomic and durable writes (a change either fully happens and survives a crash, or does not happen), and controlled concurrent access (two programs reading and writing at once cannot corrupt what the other is doing). A DBMS also keeps one logical view of the data stable even when the physical storage underneath it changes — a property called data independence.
Example: PostgreSQL, MySQL and Oracle Database are all database management systems; customers.txt on its own is not one, no matter how carefully a program writes to it, because nothing enforces a rule like "every order's customer_id must point at a real customer" or stops two programs from writing to the file at the same instant.
A DBMS earns its place by giving an application four things plain files cannot, on their own, guarantee:
- No needless redundancy. A fact is stored once; everything else refers to it.
- Enforced integrity. Rules such as "every order needs a real customer" are checked by the DBMS itself, not by hoping every program remembers to check.
- Safe concurrent access. Two programs can read and write at the same time without corrupting each other's work — Level 7 explains exactly how.
- Durability after a crash. Once the DBMS confirms a write, that write survives a power loss — Level 8 explains exactly how.
For the curious Files are not banned, just outgrown
A single small program, used by one person, often has no need for a DBMS at all — a plain file is simpler and entirely reasonable there. The problems in part 1 appear specifically once more than one program, or more than one person, needs to share the same data reliably. That is the line a DBMS is built to sit on.