- Foundation
- About 11 min
- 5 practice questions
Database models: hierarchical, network, relational and NoSQL
Compare the main ways of organising a database and see why the relational model became the most widely taught and used.
If something looks wrong, please tell us.
A database can be organised in more than one way. The way data is arranged and linked is called a data model. Questions on this topic ask you to match a description to a model, so it helps to picture each one.
Hierarchical model
Data is arranged like an upside-down tree. Each record (child) has exactly one parent, and one parent can have many children. Think of a school: the school has classes, and each class has students. To reach a student you must travel down from the top through the class. This is simple and fast for one-to-many data, but it cannot easily show that one record belongs to two parents.
Network model
The network model also uses links, but a child can have more than one parent. A student who belongs to both a sports club and a music club can be linked to both. The structure is a web of connections. It is more flexible than the tree, but the links are complex to design and change.
Relational model
Data is stored in tables (relations) made of rows and columns. Tables are linked by common values, called keys, rather than by physical pointers. A student table and a class table are connected through a ClassID column. This model is easy to understand, and a language called SQL is used to work with it. Most school and office databases, and popular software such as MySQL, Oracle and PostgreSQL, are relational.
NoSQL databases
NoSQL is a broad name for databases that do not use the fixed table structure of the relational model. Some store documents (like small files of data), some store simple key and value pairs, and some store connections between items. They are often chosen when data does not fit neatly in rows and columns or when the data is spread over many computers. 'NoSQL' is commonly read as 'not only SQL'.
| Model | Shape | Parents per child | Example picture |
|---|---|---|---|
| Hierarchical | Tree | One | Folders inside folders; school to class to student |
| Network | Web | Many | A student in several clubs |
| Relational | Tables | Not applicable; linked by keys | Student table linked to Class table |
| NoSQL | Documents, key-value or graph | Depends on the type | A profile stored as one flexible document |
Worked examples
Example 1. A company stores departments, and each employee belongs to exactly one department. Which model matches this tree structure? The hierarchical model, because every child has one parent.
Example 2. A teacher can teach many classes, and a class has many teachers. Why does a strict tree fail here? A class would need two or more parents (its teachers). The network model, or better the relational model with a linking table, handles this many-to-many situation.
Example 3. A school office wants lists such as 'all students of class 10 whose fees are unpaid', and it wants to ask many different questions later. Which model is the most suitable among the four? The relational model, because tables and SQL make it easy to ask new questions without redesigning the links.
Tree = hierarchical, web = network, tables = relational, flexible non-table stores = NoSQL.
Which one do exams expect?
- Most syllabuses focus on the relational model: tables, keys, relationships and SQL.
- Know one-line descriptions of the other models.
- Remember that in the relational model, tables are connected by matching values, not by drawing lines between physical records.
Key takeaways
- A data model decides how data is arranged and linked.
- Hierarchical records have one parent; network records can have many.
- Relational databases use tables and SQL.
- NoSQL covers flexible, non-table databases.
Check your understanding
-
1. In which model does every child record have exactly one parent?
- Network
- Relational
- Hierarchical
- Spreadsheet
Show answer
Answer: C. The hierarchical model is a tree in which each child has a single parent.
-
2. A student linked to two clubs fits most naturally in the
- Hierarchical model only
- Network model
- Single flat list
- Printer queue
Show answer
Answer: B. A record with more than one parent is the feature of the network model.
-
3. Data kept in tables and linked by keys belongs to the
- Relational model
- Network model
- Hierarchical model
- Graph paper
Show answer
Answer: A. Tables of rows and columns linked through keys describe the relational model.
-
4. SQL is mainly used with
- Photo editing tools
- Relational databases
- Printer driver files
- Antivirus programs
Show answer
Answer: B. SQL is the standard language for creating and querying relational databases.
-
5. 'NoSQL' is commonly read as
- No use of data
- New SQL tables
- Network SQL
- Not only SQL
Show answer
Answer: D. NoSQL databases do not rely only on the fixed table structure, so the name is read as 'not only SQL'.
Sign in to keep track of the lessons you finish.