Queries with several conditions
About this lesson: Queries with several conditions
In short
A query finds records that match conditions. With AND, both must be true; with OR, either is enough. Change the year and rating and switch between AND and OR.

What you'll explore
- AND and OR: Both, or either?
- A query finds records that match conditions. With AND, both must be true; with OR, either is enough.
- Across two tables: JOIN, then filter
- Which students scored highly in Science? Names are in one table and scores in another. The query joins them on StudentID, then filters.
- Write the query: From words to conditions
- Each part of a question becomes a condition. Look at three questions and their WHERE clauses.
- Check yourself: AND or OR?
- You want films that are both a comedy and shorter than 100 minutes.
Also in this lesson
- Common mix-ups
- Examples
- Card query
Words to know
- query
- A request for data that matches conditions.
- condition
- A test such as Year > 2018.
- AND
- Both conditions must be true.
- OR
- At least one condition must be true.
- JOIN
- Combining related tables in a query.
Sources
- BBC Bitesize KS3 Computer Science
- Raspberry Pi Foundation, Computing curriculum resources