Why this matters
Almost every app you use, from your phone's contacts to a shop's stock to a school's grades, keeps its data in a database. Understanding how data is stored, what software protects it, and how you pull answers out of it is the difference between "the computer has the data somewhere" and being able to ask it a precise question and trust the reply.
The idea
A database is data kept in a fixed format so it is easy to find, change, and share. The software that builds and runs one is a database management system (DBMS). A DBMS is judged on five guarantees: consistency (concurrent edits never conflict), integrity (no duplication or tampering), independence (the data is managed apart from the programs that read it), confidentiality (permissions and login control who gets in), and availability (backups and recovery survive a crash).
Databases come in a few shapes. A hierarchical database arranges data like a tree, a network database like a web with many links, and a relational database as a set of tables. Anything that manages data without the relational model is grouped under NoSQL.
The relational model dominates, so look closer. A table is a grid: each row is a record (one entry) and each column is a field (one attribute). By keeping a shared value (say a club code) in two tables, you link them and avoid storing the same fact twice. You talk to a relational database in SQL. Three operations cover most reads:
- Selection keeps only the rows that match a condition.
- Projection keeps only the columns you ask for.
- Join stitches two tables together on a shared value.
The trap is selection versus projection: rows are selection, columns are projection.
Picture it
flowchart TD
DB[Database: data in a fixed format] --> DBMS[DBMS manages it]
DBMS --> G[Five guarantees: consistency, integrity, independence, confidentiality, availability]
DB --> T{What shape?}
T --> H[Hierarchical = tree]
T --> N[Network = web of links]
T --> R[Relational = tables]
R --> OPS[SQL operations]
OPS --> S[Selection: pick rows]
OPS --> P[Projection: pick columns]
OPS --> J[Join: link tables]
Worked example
Start with a Student table (student code, name, club code) and a Club table (club code, club activity). You want one table showing each student's name and their club activity.
First join the two tables on the shared club code, so now every student row also carries its club activity. Then project down to just the name and club activity columns, dropping the codes. Because the club code is gone from the result and data from two tables was combined, the operations used were a join followed by a projection. If instead you had kept all columns but shown only the students whose club code is C2, that filtering of rows would be a selection.
Your turn
Try the practice questions: name the five DBMS guarantees, match each database type to its shape, and read a result table to decide whether selection, projection, or join produced it.
Recap
- A database stores data in a fixed format; a DBMS runs it with five guarantees: consistency, integrity, independence, confidentiality, availability.
- Database shapes: hierarchical (tree), network (web), relational (tables); everything else is NoSQL.
- In a relational database a row is a record, a column is a field, and you query with SQL: selection picks rows, projection picks columns, join links tables.