---
title: "IGCSE Computer Science SQL Queries Explained (0478)"
description: "IGCSE Computer Science SQL queries (0478) explained: SELECT, WHERE, ORDER BY, SUM, COUNT, AND and OR, with six worked examples and mistakes to avoid."
url: https://teachverse.app/blog/igcse-computer-science-sql-queries-0478
published: 2026-11-20T14:05:37.120Z
updated: 2026-11-20T14:05:37.120Z
tag: "Subject guides"
keywords: ["IGCSE Computer Science SQL", "0478 SQL queries", "IGCSE SQL SELECT WHERE", "IGCSE databases 0478", "SQL COUNT SUM IGCSE", "IGCSE computer science revision"]
author: "TeachVerse"
---

# IGCSE Computer Science SQL Queries Explained (0478)

IGCSE Computer Science SQL queries (0478) look intimidating the first time you see one, but the syllabus only asks for a small, predictable toolkit. Once you can read a query line by line and predict its output, most SQL marks become some of the easiest in Paper 2.

This guide covers exactly what Cambridge expects, a four-step method for reading any query, six worked examples on one practice table, and the mistakes that lose marks.

## What does the 0478 syllabus actually require for SQL?

In the 2026-2028 Cambridge IGCSE Computer Science (0478) syllabus, databases sit in Topic 9. Candidates must be able to "read, understand and complete" SQL scripts that query data stored in a **single database table**, and to identify the output of an SQL statement for given table contents ([Cambridge International, 0478 syllabus 2026-2028](https://www.cambridgeinternational.org/Images/697167-2026-2028-syllabus.pdf)).

The syllabus limits SQL to these words:

| Keyword | What it does |
|---|---|
| `SELECT` | Chooses which fields (columns) to show |
| `FROM` | Names the table |
| `WHERE` | Keeps only records (rows) that meet a condition |
| `ORDER BY` ... `ASCENDING` / `DESCENDING` | Sorts the results |
| `SUM` | Adds up the values in a numeric field |
| `COUNT` | Counts records |
| `AND`, `OR` | Combine conditions |

Nothing else is listed, so you do not need joins, `INSERT`, `UPDATE` or `LIKE` for 0478. Always check the syllabus for your exam year, because Cambridge can update the wording between syllabus cycles. Databases belong to the content examined in Paper 2 (Algorithms, programming and logic).

> Tip: The syllabus writes the sort order as `ORDER BY ASCENDING` and `ORDER BY DESCENDING`. Copy that style in your answers rather than shortening it, so your query matches what you have been taught.

## The practice table

Every example below uses this table, called `Laptops`. It has six records and five fields. `ID` is the primary key because every value is unique.

| ID | Brand | Type | Price | Stock |
|---|---|---|---|---|
| 1 | Zenta | Student | 350 | 12 |
| 2 | Orbit | Gaming | 900 | 3 |
| 3 | Zenta | Gaming | 1100 | 5 |
| 4 | Lumo | Student | 400 | 0 |
| 5 | Orbit | Student | 450 | 8 |
| 6 | Lumo | Gaming | 950 | 2 |

The data types are sensible too: `ID`, `Price` and `Stock` are integers, while `Brand` and `Type` are text.

## A four-step method for reading any SQL query

1. **Find FROM.** This tells you which table you are using.
2. **Apply WHERE.** Cross out every record that fails the condition. If there is no `WHERE`, every record stays.
3. **Apply SELECT.** Keep only the fields named. `*` means all fields.
4. **Apply ORDER BY, SUM or COUNT.** Sort what is left, or total or count it.

Notice that you do not read left to right. The query is *written* with `SELECT` first, but the easiest way to *work it out* is to start with `FROM` and `WHERE`. This is the same habit as filling in a trace table: work through it step by step instead of guessing. If you want practice with that skill, see our guide to [IGCSE Computer Science trace tables](/blog/igcse-computer-science-trace-tables).

## Worked examples

### Example 1: SELECT with WHERE and ORDER BY

```sql
SELECT Brand, Price
FROM Laptops
WHERE Type = 'Gaming'
ORDER BY Price DESCENDING
```

Step 1: table is `Laptops`. Step 2: keep only the Gaming records (IDs 2, 3 and 6). Step 3: show only `Brand` and `Price`. Step 4: sort by `Price`, highest first.

| Brand | Price |
|---|---|
| Zenta | 1100 |
| Lumo | 950 |
| Orbit | 900 |

### Example 2: COUNT

```sql
SELECT COUNT(ID)
FROM Laptops
WHERE Stock > 0
```

Keep records where `Stock` is greater than 0: IDs 1, 2, 3, 5 and 6. ID 4 has no stock. `COUNT` counts the records that remain, so the output is **5**.

### Example 3: SUM

```sql
SELECT SUM(Stock)
FROM Laptops
WHERE Brand = 'Orbit'
```

Orbit laptops are IDs 2 and 5, with stock of 3 and 8. `SUM` adds them: 3 + 8 = **11**.

> Tip: `SUM` only makes sense on a numeric field. You can add up `Stock` or `Price`, but you cannot sensibly `SUM` a text field such as `Brand`. Use `COUNT` when the question asks "how many".

### Example 4: AND

```sql
SELECT ID
FROM Laptops
WHERE Type = 'Student' AND Price < 420
```

`AND` means both conditions must be true for the same record. Student laptops are IDs 1, 4 and 5. Of those, only IDs 1 (350) and 4 (400) cost less than 420. Output: **1** and **4**.

### Example 5: OR

```sql
SELECT Brand
FROM Laptops
WHERE Brand = 'Lumo' OR Price > 1000
```

`OR` means at least one condition must be true. Lumo records are IDs 4 and 6. The only price above 1000 is ID 3 (Zenta, 1100). Records 3, 4 and 6 qualify, so the output, in table order, is **Zenta, Lumo, Lumo**. Notice that `Lumo` appears twice, because SQL shows one row per matching record unless told otherwise.

### Example 6: Writing a query from a description

*Show the brand and stock of every laptop with fewer than 5 in stock, with the lowest stock first.*

Break the sentence into parts. Fields: `Brand`, `Stock`. Table: `Laptops`. Condition: `Stock < 5`. Sort: lowest first, which is ascending.

```sql
SELECT Brand, Stock
FROM Laptops
WHERE Stock < 5
ORDER BY Stock ASCENDING
```

Output: Lumo 0, Lumo 2, Orbit 3.

## Common SQL mistakes that cost marks

- **Forgetting `FROM`.** Every query needs a table name.
- **Missing quotes on text.** Text values such as `'Gaming'` go in quotes. Compare `Type = 'Gaming'` with the incorrect `Type = Gaming`.
- **Mixing up `COUNT` and `SUM`.** `COUNT` gives how many records; `SUM` gives a total of a number field. In Example 2, counting gives 5 but summing `Stock` would give 30.
- **Sorting the wrong way.** Ascending is smallest first (or A to Z). Descending is largest first (or Z to A).
- **Including fields that were not selected.** If the query says `SELECT Brand`, your output has only a `Brand` column, even though the table has five.
- **Losing records when using `AND` instead of `OR`.** `AND` is stricter. If your output is empty or smaller than expected, check which word you used.
- **Not checking every record.** Cross off records one by one, as in the examples above, instead of scanning the table by eye.

## How to practise SQL for IGCSE Computer Science

Reading queries is a skill that improves with repetition, and the research on learning backs this up: actively retrieving and applying what you know produces better long-term memory than re-reading notes ([Roediger & Karpicke, 2006](https://doi.org/10.1111/j.1467-9280.2006.01693.x)). Try this routine:

1. Invent a small table of your own with six or seven records, such as your class, your music collection or a school canteen menu.
2. Write five queries using different keywords, then work out each output on paper.
3. Swap with a friend and check each other's answers.
4. Practise turning a sentence into a query, as in Example 6, because "complete the script" tasks reward this skill.
5. Mix SQL into your wider revision. Our guide to [IGCSE command words](/blog/igcse-command-words-explained) helps with the wording of other Paper 2 questions, and [logic gates and truth tables](/blog/igcse-computer-science-logic-gates-truth-tables) is another topic where a systematic method wins marks.

Explaining a query out loud is useful too. Describing in your own words what `WHERE` does and then predicting an output tests whether you really understand, rather than just recognise, the keywords. This is the idea behind [learning by teaching](/blog/learn-igcse-by-teaching), and it is how TeachVerse works: you explain a syllabus topic to an AI pupil, and its answers to exam-style questions show where your explanation had gaps. TeachVerse's questions are original and written in the style of Cambridge IGCSE papers; they are not real past papers.

## Quick revision checklist

- I can name the SQL words the syllabus lists: `SELECT`, `FROM`, `WHERE`, `ORDER BY`, `SUM`, `COUNT`, `AND` and `OR`.
- I can follow `FROM`, then `WHERE`, then `SELECT`, then sort or total.
- I can say the difference between `COUNT` and `SUM` and give an example of each.
- I can write a query from a sentence, quoting text values correctly.
- I can explain what a primary key is and choose a suitable one.

## Try it yourself

Pick one of the six tables or queries above, cover the answer, and predict the output before checking. Then build your own table and repeat. If you would like to test your database knowledge by teaching it, you can [start free on TeachVerse](/get-started).
