Module 02 · lesson 3
AND, OR, NOT: complex conditions
A buyer is looking for electronics cheaper than $100 to stock up the budget segment. That's already two conditions at once.
You'll need:Comparison operators(opens in a new tab)
Combining conditions
Logical operators combine several conditions:
AND— true when both conditions hold;OR— true when at least one does;NOT— negation of a condition.
For example, books cheaper than $30:
SELECT name, category, price
FROM products
WHERE category = 'Books' AND price < 30;
A row passes only if both parts are true. As for precedence: AND is "stronger" than OR, so when you mix them — add parentheses to avoid a surprise (there's a separate lesson on this).
Your turn
The buyer needs electronics cheaper than $100. Output the name, category, and price of such products.
Summary
AND— both conditions;OR— at least one;NOT— negation.