Topic practice collection

WHERE Clause & Filtering SQL practice questions

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 a problem

Work in the live editor where supported. Advanced guided labs state their engine boundary before you open the workspace.

  1. Problem 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 problem →
  2. Problem 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
    • Sorting

    SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided

    Open problem →
  3. Problem 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 problem →
  4. Problem 4Easy

    Find Employees by Name Prefix

    Find employees whose first name begins with J.

    • Filtering

    SQLite + PostgreSQL + MySQL + SQL Server live · 1 guided

    Open problem →
  5. Problem 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 problem →
  6. Problem 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 problem →
  7. Problem 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 problem →
  8. Problem 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 problem →
  9. Problem 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 problem →
  10. Problem 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 problem →
  11. Problem 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 problem →
  12. Problem 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 problem →
01

Attempt

Write a query or design from the brief before opening any hints.

02

Validate

Run it against the included dataset and inspect the output.

03

Explain

Compare the verified answer and explain each choice aloud.

Learn before practicing WHERE Clause & Filtering

Strengthen your understanding with these targeted learning topics: