Plain text file vs relational database
In short: what’s the difference
A plain text file stores data as a set of lines with no built-in rules: who changes a row and when is up to the application. A relational database stores data in tables with a schema, keys, and integrity constraints. So a text file fits simple local tasks, while a relational DB fits multi-user systems where correctness, relationships, and predictable queries matter.
Plain text file: no schema or built-in integrity control
Relational DB: tables, types, PK/FK, and constraints
Files — for simple scenarios; DB — for business-critical data
SQL gives structured queries and reliable links between entities
Switch the mode (Plain Files / Relational DB buttons) and click a row
📄users
| id | name |
|---|---|
| 1 | Ivan |
| 2 | Anna |
📄courses
| id | title | price_rub |
|---|---|---|
| 101 | SQL Basics | 600 |
| 102 | Java Core | 800 |
| 103 | PostgreSQL Pro | 900 |
| 104 | Spring Boot: API | 1100 |
| 105 | Docker for Backend | 700 |
📄enrollments
| id | status | user_id | course_id |
|---|---|---|---|
| 9001 | paid | 1 | 101 |
| 9002 | paid | 2 | 102 |
| 9003 | paid | 2 | 104 |
In “File” mode, data looks like separate fragments with no single set of rules: relationships between the “users”, “courses”, and “enrollments” tables are not checked automatically — duplicates and inconsistent rows are easy to get.
The DBMS as guarantor of correctness
A DBMS (database management system) introduces transactions: a set of operations is either fully committed or rolled back. At the same time, row locks and data versions work in parallel: while one session changes a balance, another waits or reads a consistent state — not an “old copy from a file.” Picture the DBMS as a bouncer at the data door: without a queue, rule checks, and a log, no one blindly rewrites critical amounts.
Glossary: database, DBMS, transaction, concurrent access
These four definitions are foundational. Learn them together: data lives in the DB, the DBMS guards it, a transaction defines an all-or-nothing boundary, and concurrent access is about many clients at once without corrupting integrity.
Database — an integrated collection of structured data stored together with minimal redundancy.
DBMS — software for creating, maintaining, and shared use of a database by many users.
Transaction — the smallest logical unit of work that runs entirely or not at all.
Concurrent access — the DBMS’s ability to serve many users at once without breaking integrity.
⚠️Takeaway: a DBMS is a reliability mechanism for data. It defines the schema, validates relationships, manages concurrent access, and protects integrity on changes. A text file stores characters; a DBMS manages the data lifecycle.