Chapter 2 · 6 levels

Filtering rows

Keep only the rows you need with WHERE: comparisons, AND/OR/IN, date ranges, pattern matching and NULL checks.

Start

Nobody wants all 12,000 orders. They want last month’s refunds, or business customers in Texas, or products that are missing a cost. Filtering is how you turn a table into an answer.

This chapter covers WHERE with comparisons, combining conditions with AND, OR and IN, filtering a timestamp column by date without losing the last day, matching text patterns, and the single most common trap in SQL: comparing with NULL. The boss level is a data quality sweep for the operations team.

Levels

  1. Find refunded orders

    from Rachel Adams, Customer Support Lead

    where, comparison

    Code Difficulty 1 of 5 Not started

  2. Gift ideas under $50

    from Ashley Rivera, Web Content Lead

    and, or, in, precedence

    Code Difficulty 2 of 5 Not started

  3. Orders from March 2024

    from Kevin Brooks, Operations Manager

    dates, timestamp, between, half open range

    Code Difficulty 2 of 5 Not started

  4. Find Gmail customers

    from Lauren Hayes, Email Marketing Manager

    like, ilike, lower, wildcards

    Code Difficulty 2 of 5 Not started

  5. The NULL comparison trap

    from Lauren Hayes, Email Marketing Manager

    null, is null, three valued logic

    Quiz Difficulty 2 of 5 Not started

  6. Boss: data quality sweep

    from Kevin Brooks, Operations Manager

    where, is null, and or, in, date ranges

    Boss · 3 steps Difficulty 3 of 5 Not started