SQL Topic collection
WHERE Clause & Filtering SQL Topic exercises
Practice SQL WHERE clauses with realistic boundary, NULL, text, date, exclusion, and production-filtering problems.
- Exercises
- 12
- Difficulty
- Beginner to Advanced
What this collection tests
Skills and query patterns
Comparison predicates, boolean logic, ranges, dates, NULL handling, text matching, exclusions, and sargable filters
Curated exercises
Choose an exercise
Work in the live editor where supported. Advanced guided labs state their engine boundary before you open the workspace.
- Exercise 1Easy
Locate an Employee by First Name
Find the employee whose first name is exactly John.
- Filtering
SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided
Open exercise → - Exercise 2Easy
Audit Candidates Across Numeric Boundaries
Find the approved audit slice for candidates 102 through 109: compensation above $60,000 and capped at $75,000.
- Filtering
SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided
Open exercise → - Exercise 3Easy
Select Employees for Role Mapping
Find employees assigned to either IT_PROG or HR_REP.
- Filtering
SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided
Open exercise → - Exercise 4Easy
Find Employees by Name Prefix
Find employees whose first name begins with J.
- Filtering
SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided
Open exercise → - Exercise 5Medium
Apply One Salary Rule to Two Teams
Find IT or Sales candidates who earn strictly more than $70,000.
- Filtering
- Sorting
SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided
Open exercise → - Exercise 6Medium
Review Candidates at Inclusive Salary Boundaries
Find candidates earning from $60,000 through $75,000.
- Filtering
- Sorting
SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided
Open exercise → - Exercise 7Medium
Extract February Payment Events
Find completed payment events that occurred during February 2025.
- Filtering
- Sorting
SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided
Open exercise → - Exercise 8Medium
Audit Unusable Active Contact Numbers
Find active contacts whose phone is NULL, empty, or whitespace-only.
- String functions
- NULL handling
- Filtering
SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided
Open exercise → - Exercise 9Hard
Exclude Jobs Safely When Rules Contain NULL
Find employees whose job code does not match any exclusion rule.
- Subqueries
- Filtering
- Sorting
SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided
Open exercise → - Exercise 10Medium
Match Imported Names Across Letter Case
Find every contact matching ALICE JOHNSON regardless of letter case.
- String functions
- Filtering
- Sorting
SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided
Open exercise → - Exercise 11Hard
Rewrite a Date Filter for Index Use
Find events that occurred on February 14, 2025.
- Date analysis
- Filtering
- Sorting
SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided
Open exercise → - Exercise 12Hard
Build a Production Review Cohort
Find eligible candidates who joined during 2023–2024 and have a usable contact status.
- String functions
- Filtering
- Sorting
SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided
Open exercise →
Attempt
Write a query or design from the brief before opening any hints.
Validate
Run it against the included dataset and inspect the output.
Explain
Compare the verified answer and explain each choice aloud.
Learn before practicing WHERE Clause & Filtering
Strengthen your understanding with these targeted learning topics:
Continue practicing
Build the next SQL skill
SELECT Statements
Select columns, filter rows, remove duplicates, and order query results.
CASE Statements & Conditional Logic
Build NULL-aware classifications, precedence-safe decisions, flags, scores, and guarded calculations with portable CASE expressions.
Date Operations & Time-Based Analytics
Practice date arithmetic, safe timestamp ranges, calendar bucketing, dense time series, rolling windows, growth, and cohort analysis.
Open the interactive workspace and practice across SQL topics.