📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials PostgreSQL Essentials WHERE Clause

WHERE Clause

5 min read Quiz at the end
WHERE filters rows. Use =, !=, <, >, BETWEEN, LIKE, IN, and IS NULL. Never use = NULL — always use IS NULL. Combine conditions with AND and OR and use parentheses to control the evaluation order.

Filtering Rows with WHERE

SELECT * FROM users WHERE age > 25;
SELECT * FROM users WHERE name = 'Alice';
SELECT * FROM users WHERE age BETWEEN 20 AND 30;
SELECT * FROM users WHERE name LIKE 'A%';
SELECT * FROM users WHERE age IN (25, 30, 35);
SELECT * FROM users WHERE email IS NOT NULL;
SELECT * FROM users WHERE age > 20 AND name LIKE 'B%';
Topic Quiz · 5 questions

Test your understanding before moving on

1. Which operator checks a range?
💡 Wait — BETWEEN checks a range: WHERE age BETWEEN 20 AND 30.
2. Which operator matches a pattern?
💡 LIKE with % wildcard matches text patterns.
3. How do you check for NULL values?
💡 Use IS NULL or IS NOT NULL — never = NULL.
4. Which operator checks multiple values?
💡 IN checks if a value is in a list: WHERE age IN (25, 30, 35).
5. Which keyword inverts a condition?
💡 NOT inverts a condition: NOT IN, NOT LIKE, NOT BETWEEN.