Databases and SQL quiz
Practise records, fields, primary keys, validation, filtering, sorting, and simple single-table SQL queries.
syllabus — topic scope & references
- Identify fields, records, and primary keys
- Read SELECT, WHERE, COUNT, and ORDER BY queries
- Distinguish validation from proof that data is accurate
Cambridge IGCSE 0478 (2026–2028): 9 Databases.
IB Computer Science (first assessment 2027): A.3 Databases.
Original practice on shared foundations. Topic-area links do not imply complete syllabus or SL/HL coverage. Not affiliated with or endorsed by Cambridge or the IB.
Related: Programming fundamentals · Boolean logic and truth tables
review — read all questions & worked answers
Databases and SQL: questions, answers & explanations
This is the readable reference for the same 10 MCQs. Close this file to continue your quiz, or type quiz to start again.
1. In a database table, what is a record?
- a) A single column heading
- b) One row describing an instance of the thing stored
- c) The entire database software package
Answer: b) One row describing an instance of the thing stored
A record is one row, such as one student's details. Each field holds a particular attribute in that record.
2. What is a field in a database table?
- a) An attribute represented by a column, such as surname
- b) A complete collection of all tables
- c) A command to delete the database
Answer: a) An attribute represented by a column, such as surname
A field represents an attribute of the stored items. For example, each student record may have a surname field.
3. Which statement about a primary key is correct?
- a) It must be the person's first name
- b) Its value should be duplicated in every record
- c) It uniquely identifies each record and cannot be null
Answer: c) It uniquely identifies each record and cannot be null
A primary key must distinguish each record. A unique student ID is more suitable than a first name that several students might share.
4. What does this SQL query select? SELECT name FROM Students WHERE mark >= 50;
- a) Every field from every student
- b) Names of students whose mark is at least 50
- c) Only students whose mark is exactly 50
Answer: b) Names of students whose mark is at least 50
SELECT chooses the name field. WHERE keeps records for which mark is greater than or equal to 50.
5. What does COUNT(*) return for a query's matching records?
- a) The number of matching rows
- b) The sum of all numeric fields
- c) The number of characters in the table name
Answer: a) The number of matching rows
COUNT(*) counts rows. SUM would be used to add a numeric field's values.
6. What does ORDER BY mark ASC do?
- a) Delete the lowest mark
- b) Put the greatest mark first
- c) Sort results from the smallest mark to the greatest
Answer: c) Sort results from the smallest mark to the greatest
ASC means ascending order. For numeric marks, that means lowest to highest.
7. Which data type suits a field that stores whether a library book is on loan?
- a) An image
- b) Boolean
- c) A long paragraph of text
Answer: b) Boolean
The status has two possibilities, such as true for on loan and false for available, so a Boolean is suitable.
8. An age passes a range check of 0 to 120. What does that establish?
- a) It falls within the allowed range, but may still be the wrong person's age
- b) It is definitely the correct age
- c) It has been encrypted
Answer: a) It falls within the allowed range, but may still be the wrong person's age
Validation checks acceptability according to rules. A valid value can still be factually inaccurate.
9. Three student records have marks 40, 50, and 80. How many records satisfy WHERE mark >= 50?
- a) 1
- b) 3
- c) 2
Answer: c) 2
The marks 50 and 80 both satisfy the condition. A greater-than-or-equal comparison includes the boundary value 50.
10. What does WHERE city = 'Accra' AND active = TRUE require?
- a) Either condition may be true
- b) Both conditions must be true
- c) The city must be any value except Accra
Answer: b) Both conditions must be true
AND retains records only when both tests are true: the city is Accra and the active flag is true.
↑ ↓ recall commands · Tab autocomplete · Enter run
