Combine filters with AND
Require two conditions to be true when a query should match both rules.
Exam scope and assessment notes
This sequence follows Cambridge IGCSE Computer Science 0984, 2026–2028 syllabus Version 4, Topic 9. It covers single-table databases only and the specified SELECT, FROM, WHERE, ORDER BY, SUM, COUNT, AND and OR content. The official specimen also demonstrates NOT in a filter. Multi-table joins, GROUP BY, database implementation and the separate 2029–2031 syllabus are not mapped here. Practice is original, self-checked and does not award an official Cambridge grade. Full timed papers and human subject-teacher review remain outstanding. Cambridge states that 0984 has the same 2026–2028 subject content as 0478, with 9–1 grading. In June and November, Cambridge lists 0984 in Administrative zone 3 and for centres in Oman and the UAE. Confirm availability for your centre and exam series with Cambridge International. The separately published 2029–2031 syllabus changes to Python 3 only and removes pseudocode; this 2026–2028 route does not cover those changes.
Before you begin
- Be able to read a small table and compare values. Each lesson introduces the database and SQL terms it uses.
Work on paper. Try each question before revealing help, and explain why your method works.
Quick readiness check
A record satisfies the first condition but not the second. Does it pass an AND filter?
What you will learn
- Read an AND condition as both requirements
- Trace rows against each condition
- Use parentheses to make a combined rule clear
AND keeps records that satisfy both tests
A record matches A AND B only when both A and B are true. If either condition is false, the record is excluded.
Use AND for a filter such as Type = "Jazz" AND SoldOut = FALSE when both facts are required.
Test each part separately
For every candidate row, evaluate the first condition and the second. Include it only if both are true.
Parentheses can make a combined expression easier to read, especially when AND and OR appear together. Stay within the single-table scope of this syllabus topic.
Pause and explain
A query needs Type = "Drama" and SoldOut = FALSE. Which connector fits?
Worked example
A workshop query filters for Topic = "Robotics" AND Seats >= 10. A row has Robotics and 12 seats; does it match?
Show the worked solution
- The Topic condition is true.
- The Seats condition is also true.
- Both are true, so AND accepts the row.
Answer Yes. The row satisfies both conditions.
Try a topic test
Choose Easy, Normal or Difficult. Save your answers and open worked review after finishing.
Test this topic →From guided practice to a new situation
Write your answer and reasoning first. Use a hint only if you are stuck. The model solution is for self-checking; your written work is not automatically marked.
Does a row with Type = Jazz and SoldOut = TRUE match Type = Jazz AND SoldOut = FALSE? Explain.
Give me a hint
Evaluate both Boolean tests.
Compare my reasoning
- Type = Jazz is true.
- SoldOut = FALSE is false.
- AND requires both true.
No; the second condition fails.
Look for these in your work
- Conditions evaluated
- AND result
Write a query to select SessionID where Topic is Coding and Seats is at least 8 from WORKSHOP.
Give me a hint
Connect the two required conditions with AND.
Compare my reasoning
- Select SessionID.
- Use WORKSHOP as the table.
- Add both conditions to WHERE.
SELECT SessionID FROM WORKSHOP WHERE Topic = "Coding" AND Seats >= 8;
Look for these in your work
- Projection
- Two conditions
- Correct connector
A report needs paid bookings for course CS1. Explain why WHERE Paid = TRUE AND CourseCode = "CS1" is more precise than using OR.
Give me a hint
The report requires both properties for each row.
Compare my reasoning
- Paid = TRUE selects paid rows.
- CourseCode = CS1 selects the intended course.
- AND excludes rows that fail either requirement.
AND is precise because a returned booking must be paid and belong to CS1.
Look for these in your work
- Both business rules
- Connector justified
Common mistakes
- Using OR when both requirements must hold
- Checking only one condition
- Forgetting that AND excludes a row if either condition fails
What can you explain now?
When does A AND B evaluate to true?
Compare with the explanation
Only when both A and B are true
AND requires every connected condition to be satisfied.
After trying it yourself, choose your next review. This is your self-assessment.
Your review choice appears on Today. Sign in to sync it across devices.
Make it stick
What must be true for a row to pass an AND filter?
If you needed the solution, close it and solve the problem again from a blank page. A correct answer is stronger when you can explain the reason for each step.