A WHERE clause filters individual rows before grouping. Be explicit about dates, null values and Boolean conditions so a report's inclusion rules are reproducible.
Before you begin
Use a disposable practice database with fictional tables. Record the database dialect and schema; syntax and features can differ between systems.
Work through the idea
Write down what one row represents and which keys should be unique. Predict a small result by hand before running a query. Compare row counts and totals after filtering or joining. Keep null handling, duplicate keys and date boundaries explicit so that a plausible output does not hide an incorrect query.
- Select needed columns
- Group related conditions with parentheses
- Use appropriate null checks
Practice task
Query fictional orders within a defined half-open date interval and exclude cancelled records.
Check your result
Explain rows at each boundary and the treatment of missing status.
A mistake to avoid
Do not use equality to test for SQL NULL.
Keep a review note
Save the inputs or scenario, your reasoning and the result you checked. Explain one assumption and one case that needs more work. Revise the exercise after feedback and distinguish what you demonstrated from what remains untested.
Official reference for further study
Explore the related learning path · Choose another worksheet
