Skip to content
SPM Tuition
Computer Science chapter guide

Data and databases

Tables, keys and SQL feel like separate topics, and you cannot see how they connect.

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.

Common questions

Where should I start in this topic?

Start with entities, attributes and relationships, because every later idea depends on them. Then learn primary and foreign keys, read a diagram, and only then write queries. Skipping the first step makes the SQL feel like memorised code.

Do I need to memorise SQL?

You need to read and write the simple forms your course covers, such as SELECT with WHERE and ORDER BY. Understanding the table you are querying matters more than remembering every keyword.

Is this the same as the ICT subject?

No. This guide follows the Computer Science subject. Check the current syllabus and scope with your teacher and the Lembaga Peperiksaan website, since the topics covered at school can differ.

If the database topics still feel disconnected, one-to-one Computer Science lessons let a teacher build one small database with you from entities to queries.

  • Online one-to-one lessons for your child with an experienced teacher.
  • Your first class is a one-hour trial, from RM50. The fee is agreed before you book.
  • Happy with the teacher? Continue with lessons of about 1.5 hours. If not, ask for another teacher.