Learn in your language
Skip to content
IGCSE · Cambridge (CIE) · 0478

Combine alternatives with OR

Use OR when a row may match either of two valid alternatives.

Section 9 · Databases

Cambridge IGCSE Computer Science 0478 · Databases · 2026–2028 Version 6 · Topic 9
Exam scope and assessment notes

This sequence follows Cambridge IGCSE Computer Science 0478, 2026–2028 syllabus Version 6, 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.

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 row meets both conditions joined by OR. Is it included?

What you will learn

  • Distinguish OR from AND
  • Trace whether at least one condition is true
  • Recognise a broad filter that may include both alternatives

OR accepts either true condition

A OR B is true when at least one condition is true. It is also true when both are true.

Use OR when a report needs records for either of two types, such as Topic = "Robotics" OR Topic = "Coding".

Avoid accidentally broadening a filter

AND narrows results by requiring all conditions; OR broadens results by accepting alternatives. Read the requirement carefully before choosing.

The official specimen also shows NOT applied to a Boolean field in a WHERE condition. That is useful to read, but the syllabus's listed SQL operators explicitly name AND and OR.

Pause and explain

A report needs records for either Category A or Category B. Which connector fits?

Put the idea to work

Worked example

A query returns sessions where Topic is Art OR Topic is Music. Which topic values are accepted?

Show the worked solution
  1. Test whether Topic equals Art.
  2. Test whether Topic equals Music.
  3. A row matching either condition is included.

Answer Art and Music records are included; any other topic is excluded.

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.

1 · Guided

A record has Type = Comedy. Does it pass Type = Comedy OR Type = Drama?

Give me a hint

Only one of the alternatives needs to be true.

Compare my reasoning
  1. The Comedy comparison is true.
  2. The Drama comparison is false.
  3. OR accepts the row because one test is true.

Yes, it matches the first alternative.

Look for these in your work

  • Comparisons evaluated
  • OR result
2 · Independent

Write a query to return Title for performances of either Jazz or Classical from PERFORMANCES.

Give me a hint

Use two equality conditions joined by OR.

Compare my reasoning
  1. Select Title.
  2. Use the PERFORMANCES table.
  3. List the two allowed Type values.

SELECT Title FROM PERFORMANCES WHERE Type = "Jazz" OR Type = "Classical";

Look for these in your work

  • Projection
  • Both alternatives
  • OR used
3 · Transfer

A report should show unpaid bookings for course CS1 only. Explain why Paid = FALSE OR CourseCode = "CS1" returns too many rows and correct it.

Give me a hint

Both properties must hold for each result.

Compare my reasoning
  1. OR accepts any unpaid booking, even from another course.
  2. It also accepts any CS1 booking, even if paid.
  3. Join the conditions with AND.

Use WHERE Paid = FALSE AND CourseCode = "CS1" because both requirements are necessary.

Look for these in your work

  • Over-inclusion explained
  • Correct connector

Common mistakes

  • Using OR when a row must meet both rules
  • Assuming OR excludes a row that meets both
  • Treating NOT as one of the SQL operators explicitly listed in the syllabus
Recall without your notes

What can you explain now?

When does A OR B evaluate to true?

Compare with the explanation

When at least one condition is true

OR accepts either alternative or both.

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

How does OR change the set of matching records compared with AND?

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.

Keep learning Computer Science

Course scope and assessment

165 original lessons map the listed objectives across all 10 main topics in the 2026–2028 Version 6 syllabus, with worked explanations and guided, independent and transfer practice. This is mapped teaching coverage, not proof of full exam readiness. Three earlier starter lessons remain available but are not counted as syllabus-mapped teaching. Practical programming experience in an executable browser workspace, full timed-paper practice, human subject-teacher review and the separate 2029–2031 syllabus remain outstanding. Practice is self-checked and does not award an official Cambridge grade.

StudyForA · Learn with understanding

Original teaching content and links to official sources. Check your exam year and qualification before using a resource.