How to combine conditions

Require both with AND

AND keeps a row only when both conditions are true.

SELECT *
FROM courses
WHERE level = 'beginner'
  AND duration_minutes < 90;

Allow either with OR

OR keeps a row when at least one condition is true.

SELECT *
FROM courses
WHERE level = 'beginner'
   OR level = 'intermediate';

Reverse with NOT

NOT negates a condition. Clear positive conditions are often easier to understand.

SELECT *
FROM courses
WHERE NOT archived;

Use parentheses

AND is evaluated before OR. Parentheses make the intended grouping explicit and prevent subtle mistakes.

WHERE active = 1
  AND (level = 'beginner' OR level = 'intermediate')