A data model is a way of describing how data is structured, how pieces of data relate to each other and what rules apply to them. It acts like a plan or blueprint for a database. Data models are described at different levels: a conceptual model shows the main things (entities) and relationships, often as an Entity-Relationship (ER) diagram; a logical model describes tables, fields and keys; and a physical model describes how data is actually stored on disk.
Key terms
- Data model
- description of the structure, relationships and rules of data
- Entity
- a thing about which data is stored, e.g. Student
- Attribute (field)
- a property of an entity, e.g. Name
- Record (tuple)
- one row of a table
- Primary key
- field that uniquely identifies each record
- Foreign key
- field linking to the primary key of another table
- ER diagram
- drawing of entities, attributes and relationships
Summary
- A data model is a blueprint for organising data.
- Hierarchical = tree; network = graph; relational = tables.
- Primary keys identify records; foreign keys link tables.
- ER diagrams show entities, attributes and relationships.
In everyday life: A kebele's household records naturally form a one-to-many relationship: one household has many family members.
Check yourself
- Who proposed the relational model?
- What is the difference between a primary key and a foreign key?
- Why is the hierarchical model rigid?
- Name the three types of relationship.
Practice questions
1. In the relational model, a row of a table is also called a:
- A. Field
- B. Record (tuple)
- C. Schema
- D. Query
Show answer
Answer: Record (tuple)
Each row describes one entity instance and is called a record or tuple; columns are fields (attributes).
2. True or false: A primary key may contain duplicate values.
Show answer
Answer: False
A primary key must uniquely identify each record, so duplicates (and empty values) are not allowed.
On WeLearn
The full lesson: reading notes, worked examples, class activities and the Unit 3 quiz
Study Data Models on WeLearnTeach Data Models with WeLearn
We will bring a demo to your school: a lesson on your interactive TV, a virtual lab and a classroom game, with your own teachers.
