The Basics · WHERE · AND
2. Active Canadian customers
Concept: WHERE · ANDshow
WHERE keeps only the rows where a condition is true. Combine conditions with AND (both must hold) or OR (either can). Text values go in single quotes: 'Canada'.
Example (different data):
SELECT title FROM products WHERE category = 'books' AND in_stock = 1;
Your task
Marketing is launching a Canada-only promo and needs a clean contact list. Churned customers must not be emailed.
Return the name and email of every active customer in Canada, sorted alphabetically by name.
Solution unlocks after 3 more tries
Starting Postgres in your browser…
query.sql
Output
Write a query and press Run Query (Ctrl/⌘ + Enter).