strawquery PT
All lessons

Lesson 5 of 30

AND, OR and parentheses

Today at the studio

Rin comes back with a shortlist problem: "I need shows that are this and that, or maybe that other thing." You ask her to slow down and write the conditions on a napkin. Byte sits on the napkin.

The idea

AND needs both conditions to be true. OR needs at least one. You can chain as many as you need.

When both appear together, AND is applied before OR. Use parentheses to say exactly what you mean: a AND (b OR c) is not the same as a AND b OR c.

Example

SELECT name FROM staff WHERE department_id = 3 AND role <> 'Composer'

Your turn

0 of 4 questions

Question 1 of 4

Which Fantasy shows are already finished? Show title.

Unofficial fan project. Titles belong to their creators and rights holders.