A DBMS (Database Management System) is software that stores data and controls every access to it. MySQL, PostgreSQL and Oracle are examples. Before DBMSs, programs kept data in plain files, and each program read and wrote its own files.
That caused real problems:
| Problem with files | How a DBMS helps |
|---|---|
| Redundancy: the same data copied in many files | One shared, normalized copy |
| Inconsistency: copies drift apart | Update once, constraints enforce rules |
| No easy querying | A query language (SQL) |
| Concurrent access corrupts data | Locking and transactions |
| A crash leaves half-done updates | Atomicity and recovery |
| Weak security | Users, roles and permissions |
Example: a bank stores a customer's address in both savings.txt and loans.txt. The customer moves, and only one file is updated. Now the bank has two addresses for one person. That is inconsistency, and redundancy caused it.
A DBMS is not free. It costs money, needs trained people and adds overhead. For a tiny single-user app, a file can be the better choice.
In interviews: "Why use a DBMS instead of files?" List redundancy, inconsistency, concurrency, atomicity and security, with one example each.