Filtering
Learn SQL filtering with practical examples and guided drills on dbSyntax.
Start with WHEREWHERE
BeginnerWHERE decides which rows are eligible for everything that comes after. If a filter is wrong, every downstream number is wrong, even when the...
AND / OR / NOT
BeginnerMost real filters are multi-part: paid orders from this quarter, customers in these three countries but not trial accounts, etc. AND, OR, an...
IN / BETWEEN
BeginnerOnce you have written a few WHERE clauses, two patterns show up over and over: "is this value one of a list?" and "is this value in a range?...
LIKE
Beginner= checks for exact equality. LIKE lets you match text by pattern: prefixes, suffixes, substrings, and single-character gaps. It is how you a...
NULL (IS NULL, COALESCE)
BeginnerNULL means missing or unknown. It is not zero. It is not an empty string. It is not false. It is the absence of a value, and SQL treats it d...