Every organization that runs for long enough ends up accumulating data: customers, products, transactions, incidents. At first that data fits in a spreadsheet and everything seems fine. The trouble comes later, when the sheet grows, several people use it at once and nobody knows which of the three versions of the file is the good one. In this lesson we are going to understand why databases exist: which concrete problems they solve, what vocabulary is used to talk about them and what role the software that manages them plays. We will not write a single line of SQL yet; the goal is that, by the time we get to it, you know exactly what you are solving and why.
So that nothing stays abstract, the whole course revolves around a single case: BiblioRed, the municipal library network of a fictional city. You will meet it in this very lesson and we will build it up module by module until we have a complete information system.
Contents
- The scenario: BiblioRed and its spreadsheets
- Data and information: not the same thing
- What a database is
- What a DBMS is (functional definition)
- Essential vocabulary: entity, attribute, table, row, column, key
- Schema and instance
- The six problems a database solves
- Diagnosing BiblioRed's spreadsheet
- Common mistakes and tips
- Exercises
- Conclusion
- The scenario: BiblioRed and its spreadsheets
BiblioRed is the municipal library network of a fictional city. It has four branches, some 12,000 registered members and a collection of around 40,000 copies. Today it works like this:
- Each branch keeps its own spreadsheet of loans, in a shared folder.
- The book catalog lives in a different sheet, maintained by someone at the central branch.
- New member sign-ups are recorded in a third file, and in some branches still on paper.
- When somebody wants to know whether a book is available, they phone the other branch.
The system "works" in the sense that the library opens every day. But it produces constant errors: duplicate loans, members with two records, books listed as available that are not. Management has decided to migrate to a real database, and we are the team that is going to design it.
In this lesson we limit ourselves to understanding the problem. The design starts in module 4.
- Data and information: not the same thing
This is the founding distinction of the whole discipline, and it pays to be clear about it from the start.
- A datum is a raw fact, with no context:
2026-03-14,9788420412146,14. - Information is the result of interpreting data in a context: "on 14 March 2026, member number 14 borrowed the book with ISBN 9788420412146".
- Knowledge appears when information is aggregated and lets you decide: "fiction loans are up 20% in March, we should reinforce that part of the collection".
| Level | What it is | Example in BiblioRed |
|---|---|---|
| Data | Isolated fact, with no meaning of its own | 2026-03-14 |
| Information | Data with context and relationships | Loan by member 14 on 14/03/2026 |
| Knowledge | Pattern extracted from a lot of information | Fiction is borrowed more in spring |
A database stores data, but it is designed to make turning that data into information cheap and reliable. That is its reason for existing: not to keep things, but to let you ask questions.
- What a database is
A database is a collection of interrelated data, organized according to a defined structure, stored persistently and managed in such a way that several users and applications can query and modify it in a controlled manner.
It is worth pulling that definition apart, because every word rules something out:
- Collection of interrelated data: it is not a pile of loose files. Loans point to members, members to branches, copies to books. The relationships are part of the database just as much as the data.
- Defined structure: before anything is stored, you decide what shape the data has. That decision is called the schema and we will see it in section 6.
- Persistent: it survives the program closing, the server restarting and, if it is properly administered, a disk failure.
- Controlled, shared access: several people can work at the same time without stepping on each other, and each one sees only what they are entitled to.
A spreadsheet satisfies "persistent" and not much more. That is why it works up to a certain size and then stops working.
- What a DBMS is (functional definition)
The database is the data. The DBMS (Database Management System) is the software that manages it. It is the piece that sits between the applications and the files on disk so that nobody has to touch those files directly.
Functionally, a DBMS offers:
- Data definition: it lets you declare which structures exist (tables, columns, types, constraints).
- Data manipulation: insert, query, modify and delete.
- Access control: who can do what.
- Concurrency control: coordinating many simultaneous users without corrupting anything.
- Failure recovery: if the power goes out halfway through an operation, leaving the data in a consistent state.
- Optimization: deciding how to execute a query as fast as possible.
flowchart LR
A["BiblioRed<br/>web application"] --> S["DBMS<br/>(PostgreSQL)"]
B["Front desk<br/>terminal"] --> S
C["Management<br/>reports"] --> S
S --> D[("Data files<br/>on disk")]
Notice the key idea in the diagram: no application touches the disk. They all talk to the DBMS, and the DBMS is the only one that knows how the data is really stored. That is what makes it possible to change the storage without breaking the applications.
Examples of DBMSs we will use in the course: PostgreSQL (a full server, our main reference), SQLite (an embedded engine, for practising without installing anything heavy) and MongoDB (document-oriented, in module 3).
What lives inside a DBMS —optimizer, storage engine, buffer manager, catalog— and how its architecture is organized is covered in detail in lesson 01-04. Here it is enough to know what it does seen from the outside.
- Essential vocabulary
This is the minimum vocabulary you need to follow the rest of the course. We present it using the BiblioRed example.
| Term | Definition | Example in BiblioRed |
|---|---|---|
| Entity | A type of real-world "thing" we store data about | Member, Book, Copy, Loan, Branch |
| Attribute | A characteristic of an entity | A Member has a name, an ID number, an email, a join date |
| Table | The structure where all the occurrences of an entity are stored | The members table |
| Column (field) | The realisation of an attribute inside a table | The email column of members |
| Row (record) | A specific occurrence of the entity | The row for the member "Marta Alsina" |
| Primary key | Column (or set of columns) that identifies each row uniquely | member_id in members |
| Foreign key | Column that points to the primary key of another table | member_id inside loans |
Visually, BiblioRed's members table might look like this:
members
+-----------+------------------+------------------------+-------------+
| member_id | name | email | branch_id | <- columns
+-----------+------------------+------------------------+-------------+
| 14 | Marta Alsina | m.alsina@example.org | 2 | <- row
| 15 | Iván Pereda | i.pereda@example.org | 1 |
| 16 | Nuria Bastos | n.bastos@example.org | 2 |
+-----------+------------------+------------------------+-------------+
^
primary keyTwo points that often confuse beginners:
- Entity is a design concept; table is its materialisation. You design thinking in entities and you implement in tables. When we get to entity-relationship diagrams (lesson 04-02) this distinction will be central.
- Row and record are used almost as synonyms, just like column and field. "Row" and "column" are the terms of the relational model; "record" and "field" come from the world of files. You will see both in the literature.
A key is simply an attribute (or combination of attributes) that serves to identify. It is such an important concept that we will devote part of module 2 to it: without keys there is no way to relate tables, and without relationships there is no relational model.
- Schema and instance
Another distinction to internalise early:
- The schema is the definition of the structure: which tables exist, which columns each one has, what type they are, which constraints they satisfy. It changes rarely, and when it does it is an event (a "migration").
- The instance (or state) is the content at a given moment: the specific rows that are there right now. It changes constantly, every time somebody borrows a book.
The usual analogy: the schema is like the definition of a blank form; the instance is all the filled-in forms sitting in the filing cabinet today.
| Schema | Instance | |
|---|---|---|
| What it describes | The structure | The data |
| How often it changes | Low (planned migrations) | High (every operation) |
| BiblioRed example | "loans has a loan_date of type date" |
"There are 3,412 active loans right now" |
| Who changes it | Designer / administrator | Users and applications |
This separation is what makes it possible to reason about a database without looking at its data: if you know the schema, you know which questions can be answered. In module 4 you will learn to design schemas and in module 5 to improve them through normalization.
- The six problems a database solves
Here is the core of the lesson. A database is not "a bigger spreadsheet": it solves six problems a sheet cannot solve.
7.1 Redundancy
The problem: the same piece of data stored in several places. In BiblioRed, the member's name appears in every loan row, in the sign-up sheet and in the overdue list.
What it causes: it takes up space (the least of it) and, above all, it forces you to update in N places. If the member changes email, you have to remember every one of them.
How it is solved: by storing each piece of data only once in its own table and referencing it from wherever it is needed. This is the principle that normalization formalises (module 5).
7.2 Inconsistency
The problem: a direct consequence of the previous one. If the data is in five places and you only update four, you now have two contradictory truths and no way to tell which one is valid.
How it is solved: by eliminating redundancy and adding integrity constraints that the DBMS enforces at all times, without relying on anybody's discipline.
7.3 Lack of integrity
The problem: nothing stops you writing nonsense. A return date earlier than the loan date. A loan tied to a member who does not exist. A duplicated ID number.
How it is solved: the DBMS lets you declare rules —data types, NOT NULL, uniqueness, foreign keys, checks— and it rejects any operation that violates them. The difference from a spreadsheet is that the rule lives in the data, not in the good intentions of whoever is typing. We will see this in lesson 02-06 and in 04-04.
7.4 Lack of concurrency control
The problem: two librarians open the sheet at the same time, each records their loan and whoever saves second wins; the first loan vanishes. Or worse: the last copy of a book is lent out twice because both of them read "available: 1".
How it is solved: the DBMS manages transactions and locks, so that simultaneous operations produce the same result as if they had been done one after another. This is the subject of module 6 (lessons 06-01 and 06-02).
7.5 Lack of security
The problem: whoever has access to the file sees everything. The intern who records loans also sees the personal details of 12,000 members and could delete them by accident.
How it is solved: users, roles and permissions per table and per operation. The front desk can insert loans but not delete members; management can read statistics but not modify the catalog. This is covered in lesson 06-04.
7.6 Lack of data independence and reliable persistence
The problem: in a spreadsheet, the way things are stored and the way they are used are one and the same. If you rearrange the columns, every formula and every report breaks. And if the file gets corrupted, the only copy is the one somebody remembered to make.
How it is solved: the DBMS separates how the data is stored from how it is queried. You can add an index, change the storage or move the table to another disk without touching a single query. This is called data independence and we will formalise it in lesson 01-04. Reliable persistence, in turn, rests on transaction logs and backups.
- Diagnosing BiblioRed's spreadsheet
Let's look at the problem with real (fictional) data. This is part of the sheet loans_branch_north.xlsx as it stands today:
| Member | Member email | Phone | Book | Author | ISBN | Branch | Loan date | Return |
|---|---|---|---|---|---|---|---|---|
| Marta Alsina | m.alsina@example.org | 600 111 222 | The Map of Time | Félix Palma | 9788401339097 | North | 02/03/2026 | 16/03/2026 |
| M. Alsina | m.alsina@example.org | 600111222 | The Map of Time | F. Palma | 9788401339097 | north | 05/04/2026 | |
| Iván Pereda | i.pereda@example.org | 600 333 444 | The Pillars of the Earth | Ken Follet | 9788401337208 | North | 07/04/2026 | 01/04/2026 |
| Marta Alsina | m.alsina@exemple.org | 600 111 222 | The Map of Time | Félix J. Palma | 978840133909 | North | 09/04/2026 | |
| Nuria Bastos | n.bastos@example.org | 600 555 666 | The Pillars of the Earth | Ken Follett | 9788401337208 | South | 10/04/2026 |
A careful look reveals at least eight defects, and every one of them is an instance of the problems in the previous section:
- Member redundancy: Marta Alsina's email and phone are written three times. If she changes phone number, three rows have to be corrected (plus those of the other three branches).
- Book redundancy: the title, author and ISBN of "The Map of Time" are repeated in every loan. With 40,000 copies and years of history, this multiplies the size of the file.
- Inconsistency in the member's name: "Marta Alsina" and "M. Alsina" are the same person, but no program knows that. Counting distinct members gives the wrong number.
- Inconsistency in the author: "Ken Follet" and "Ken Follett", "Félix Palma" and "Félix J. Palma". Searching by author returns incomplete results.
- Undetected wrong data:
m.alsina@exemple.org(one letter changed) and the ISBN978840133909(one digit missing). Nothing validated those fields when they were typed. - A business rule violated: Iván Pereda's loan has a return date (01/04) earlier than the loan date (07/04). That is impossible, and there it is.
- Inconsistent formatting: "North" and "north"; phone numbers with and without spaces. Any grouping by branch will treat "North" and "north" as different values.
- Fragmentation: Nuria Bastos's row says "South", but this is the North branch's sheet. The same information lives in two files and nobody knows which one rules.
To this we have to add two problems the table does not show but that happen every day:
- Concurrency: if two people at the front desk open the sheet at the same time, one of the two loans will be lost on save.
- No access control: anybody with access to the shared folder sees the phone numbers and emails of every member.
Where we are heading (without designing it yet)
The solution will consist of moving away from one table that mixes everything together to several tables, each with one responsibility, joined by keys:
flowchart TD
S["members<br/>(person details, once)"] --> P["loans<br/>(who, which copy, when)"]
E["copies<br/>(physical copies)"] --> P
L["books<br/>(title, ISBN, once)"] --> E
SU["branches"] --> E
With that structure, Marta Alsina's email is written only once; the ISBN of "The Map of Time", only once; the DBMS prevents you registering a loan for a member who does not exist, and a constraint prevents the return date being earlier than the loan date.
How you arrive at that design, how you justify it and how you write it in SQL is exactly the journey of modules 2, 4 and 5. For now, take away the diagnosis: every ill of the spreadsheet has a name of its own and a known solution.
Common Mistakes and Tips
- Confusing "database" with "DBMS". People say "I work with PostgreSQL" when PostgreSQL is the manager, not the database. It is a harmless imprecision in conversation, but it pays to be clear: a single DBMS hosts many databases.
- Believing a database is just a faster store. Its main value is not speed but guarantees: integrity, concurrency and recovery. A small spreadsheet may well open faster; what it cannot do is guarantee anything.
- Thinking redundancy is a space problem. Space is cheap. The problem with redundancy is that it makes inconsistency inevitable: as soon as a piece of data is in two places, sooner or later they will differ.
- Designing the database by copying the spreadsheet as it is. This is temptation number one when migrating. A wide table with 30 columns that mixes everything reproduces exactly the same problems inside the database. Migrating means redesigning.
- Starting to write tables before understanding the domain. Before creating anything you need to know which entities exist and how they relate. Spending an hour talking to the librarians saves weeks of corrections.
- Practical tip: when you analyze an existing system, always do the exercise from section 8. Take a real sample of the data and look for duplicates, contradictory values and broken rules. That inventory is the best possible justification of the project in front of whoever is paying for it.
Exercises
Exercise 1: Classify data, information and knowledge
For each item, say whether it is data, information or knowledge, and justify it briefly:
9788401337208- "Copy 3 of The Pillars of the Earth is on loan until 24/04/2026."
- "The North branch accounts for 45% of the network's loans."
Marta Alsina- "Members under 25 borrow more comics than the rest."
Exercise 2: Identify entities and attributes
Based on the description of BiblioRed and the spreadsheet in section 8, list at least four entities that should exist in the database, with three attributes each. Do not design tables or foreign keys yet: just identify the "things" in the domain and their characteristics.
Exercise 3: Diagnosing a spreadsheet
This is another BiblioRed sheet, reservations.xlsx:
| Member | Book | Pickup branch | Reservation date | Status | Staff member |
|---|---|---|---|---|---|
| Iván Pereda | The Pillars of the Earth | Central | 12/04/2026 | pending | Ana G. |
| ivan pereda | The pillars of the earth | central | 12/04/2026 | Pending | Ana |
| Nuria Bastos | The Map of Time | North | 13/04/2026 | picked up | ana g. |
| Nuria Bastos | The Map of Time | North | 32/04/2026 | Pending | Luis M. |
List every problem you find, indicating in each case which of the six problems from section 7 it corresponds to.
Solutions
Solution 1
- Data. An isolated number; without context we do not even know it is an ISBN.
- Information. Data (copy, title, date) put into relation and given meaning.
- Knowledge. It is an aggregated pattern over many loans, useful for deciding (for example, reinforcing staff at North).
- Data. A text string; on its own it does not say whether it is a member, an author or an employee.
- Knowledge. A pattern extracted from crossing two dimensions (age and category), directly actionable for the purchasing policy.
Solution 2
One reasonable answer (there are valid variants):
| Entity | Attributes |
|---|---|
| Member | full name, email address, phone |
| Book (the work) | title, ISBN, publication year |
| Copy (the physical copy) | copy code, condition, acquisition date |
| Loan | loan date, due date, actual return date |
| Branch | name, address, opening hours |
| Author | first name, last name, nationality |
The key point of the exercise is telling Book apart from Copy. "The Pillars of the Earth" is one work, but BiblioRed has six physical copies spread across branches. What gets lent out is a copy, not a book. Confusing the two is one of the most frequent modeling mistakes in library systems, and you can already sense it in the spreadsheet: there is no way of knowing which copy Marta took home.
Solution 3
| # | Problem detected | Category from section 7 |
|---|---|---|
| 1 | Rows 1 and 2 are the same reservation duplicated, written with different capitalisation | Redundancy + inconsistency |
| 2 | "Iván Pereda" / "ivan pereda" and "Central" / "central": same value, different spelling | Inconsistency (formatting) |
| 3 | "pending" / "Pending" / "picked up": the status is not restricted to a closed set of values | Lack of integrity |
| 4 | "Ana G." / "Ana" / "ana g.": the staff member is typed free-form, not referenced from an employees table | Redundancy + inconsistency |
| 5 | Date 32/04/2026: it does not exist |
Lack of integrity (data type) |
| 6 | Rows 3 and 4: the same reservation appears at once as "picked up" and as "pending" | Inconsistency (two contradictory truths) |
| 7 | The book is identified by free-text title, with no ISBN or reference to the catalog | Redundancy + lack of integrity |
| 8 | Anybody with access to the file can edit or delete any row without a trace | Lack of security |
| 9 | Two employees editing at the same time would lose one of the reservations | Lack of concurrency control |
Notice that problem 6 is especially serious: it is not a formatting error, it is that the system has no idea what the real status of the reservation is. That is the moment an organization discovers it needs a database.
Conclusion
In this lesson we have laid the conceptual foundations of the course:
- We distinguished data, information and knowledge: the database stores the first so that obtaining the second and the third is cheap.
- We defined database (a structured, persistent, shared collection of interrelated data) and DBMS (the software that manages it, guaranteeing definition, manipulation, security, concurrency and recovery).
- We fixed the vocabulary we will use throughout the course: entity, attribute, table, row, column, primary key and foreign key, and we separated schema (the structure) from instance (the data as it is right now).
- We identified the six problems a database solves: redundancy, inconsistency, lack of integrity, lack of concurrency control, lack of security and lack of data independence.
- We applied all of that to BiblioRed, diagnosing a real spreadsheet and anticipating —without designing it yet— the structure of several related tables that will replace it.
We now know what a database is and why we need one. The natural next question is: are all databases the same? The answer is no, not remotely. In lesson 01-02, Types of Databases, we will tour the big families —relational, document, key-value, columnar, graph, and several more— to understand what data structure each one proposes, which problem it was born to solve and how you decide which one suits you. And we will come back to BiblioRed to ask which parts of its system call for a relational database and which might call for something else.
Database Fundamentals
Module 1: Introduction to Databases
- Basic Database Concepts
- Types of Databases
- History and Evolution of Databases
- Database Management Systems and Architecture
Module 2: Relational Databases
- The Relational Model
- The SQL Language
- Basic SQL Operations
- Multi-Table Queries: JOINs and Subqueries
- Data Aggregation and Grouping
- Referential Integrity
Module 3: Non-Relational Databases
- Introduction to NoSQL
- Types of NoSQL Databases
- Data Modeling in NoSQL
- Comparing Relational and Non-Relational Databases
Module 4: Schema Design
- Schema Design Principles
- Entity-Relationship (ER) Diagrams
- Transforming ER Diagrams into Relational Schemas
- Data Types and Constraints
Module 5: Normalization
Module 6: Transactions, Performance, and Security
- Transactions and ACID Properties
- Concurrency and Isolation Levels
- Indexes and Query Optimization
- Security, Permissions, and Backups
Module 7: Practical Exercises
- SQL Exercises
- Schema Design Exercises
- Normalization Exercises
- Advanced Query and Transaction Exercises
Module 8: Case Studies
- Case Study: Relational Database
- Case Study: Non-Relational Database
- Case Study: Polyglot Persistence
