A database stores facts in tables that are linked by keys. The lessons below move from describing the data to drawing it to querying it.
This guide sits in SPM Computer Science. For help with the subject itself, see online one-to-one Computer Science tuition.
Why not keep everything in one table?
Imagine a canteen that records each order as one row: order number, student name, class, drink and price. The student “Aina, Form 4 Amanah” appears in every row for her orders.
If Aina moves to another class, every one of her rows must be edited. Miss one and the data disagrees with itself. Splitting students and orders into separate tables solves this, and keys are what connect them again.
What order should I study in?
| Step | Lesson | What it gives you |
|---|---|---|
| 1 | Entities, attributes and relationships | what to store |
| 2 | Primary and foreign keys | how tables link |
| 3 | Reading an entity relationship diagram | the whole design at a glance |
| 4 | Simple SQL queries | getting answers out |
After step 4, test yourself on the data and databases practice set.
Where does relational modelling fit?
Once the four basics feel steady, go deeper with relational data modelling. It covers keys when names repeat, many-to-many links, update anomalies and checking foreign keys against sample rows.
The next cluster, database development, applies the same ideas to normalising data, joining tables and checking integrity.
Who should start where?
A Form 4 student meeting databases for the first time should begin with entities. A student who can write a SELECT statement but loses marks on design questions should go to keys and diagrams.
A student who reads queries well but cannot explain why the tables are split should try the relational modelling lessons. If you want a teacher to go through your own notes, the one-hour trial class (from RM50) is a real taught lesson on the Computer Science topic you choose.