A database stores data in an organised way so it can be searched and sorted. This mini-lesson covers single-table databases, fields & records, data types, primary keys, validation, and SQL (SELECT, FROM, WHERE, ORDER BY, SUM, COUNT).
Columns are fields; rows are records.
Work through each screen, answer the questions, and collect ⭐ stars. Press Start when ready.
Fields, records & keys
Fields, records & the primary key
Field — a single column; one item of data about a thing (e.g. Surname).
Record — a single row; all the fields about one entity (e.g. one student).
Primary key — a field that uniquely identifies each record. It must have no duplicates and no blanks (e.g. StudentID).
Data types for fields: text/string, integer, real, Boolean, date/time. Choosing the right type helps validation and saves space.
Sort it
Field, record or key?
Tap a statement, then tap the group it belongs to.
🔑 Primary key
📊 Field
📄 Record
Quick check
Choosing a primary key
?Which field would make the best primary key for a table of students?
SQL basics
SQL — querying a table
SQL (Structured Query Language) fetches data from a database. The core query has three parts:
Basic query
SELECT Name, Grade — which fields (columns) to show
FROM Students — which table
WHERE Grade = 'A' — which records (rows) to include
Add ORDER BY Name ASC (or DESC) to sort the results. Text values go in single quotes; numbers do not.
Match it
Match the SQL keyword to its job
Tap a description on the left, then its matching keyword on the right.
Job
Keyword
Quick check
Reading a query
?Which SQL clause decides which records (rows) are included in the results?
SUM & COUNT
SUM & COUNT
SQL can calculate over the chosen records:
COUNT — how many records match. SELECT COUNT(*) FROM Students WHERE Grade = 'A' returns the number of A-grade students.
SUM — adds up a numeric field. SELECT SUM(Price) FROM Orders returns the total of all prices.
Worked example
Grades in a table: A, A, B, A, C. COUNT of records where Grade = 'A' is 3.
Calculate
Your turn — COUNT
1A table has these Grade values: B, A, A, B, A, B, A. What does SELECT COUNT(*) FROM Students WHERE Grade = 'A' return?
Hint: count how many of the seven values are 'A'.
Calculate
Your turn — SUM
2An Orders table has Price values: 5, 12, 3, 10. What does SELECT SUM(Price) FROM Orders return?
Hint: 5 + 12 + 3 + 10.
Quick check
Build the query
?You want the names of all students in the Students table whose grade is A, sorted A–Z by name. Which query is correct?
Quick check
Validation in a database
?A database field for age only accepts whole numbers from 0 to 120. Rejecting the entry ‘abc’ is an example of which validation check?
Quick check
Field or record?
?In a single-table database, all the data stored about one customer (name, address, phone) forms a…
Recap
The big ideas to know
Field = column · record = row · primary key = unique identifier (no duplicates)
Data types: text, integer, real, Boolean, date/time
SQL: SELECT (fields) · FROM (table) · WHERE (filter rows) · ORDER BY (sort)
Aggregates: COUNT (how many) · SUM (total of a number field)
Text values in single quotes; numbers without
Validation keeps data sensible (type, range, presence, format checks)
You’ve covered the whole of Databases. Press Finish to see your score.
🏆
Mini-lesson complete!
⭐⭐⭐
You’ve worked through Databases for Cambridge IGCSE Computer Science. 🎉
Your stars: 0 / 0
Next: test yourself in the Evaluate stage Confidence Quiz, then lock it in with Verify.
📣 Smashed it? Share your score
Challenge a mate to beat your stars, or show a parent how you got on.