SQL Practice Logo

SQLPractice Online

WHERE Clause & Filtering: Overview

Module: SQL Fundamentals

WHERE runs in step 3 of 9 — before GROUP BY, HAVING, and SELECT — shaping every downstream operation

Comparison operators =, !=, <>, <, >, <=, >= and their NULL behavior

Logical operators AND, OR, NOT and their precedence rules (AND binds tighter than OR)

NULL is not a value — it is unknown. = NULL never matches. IS NULL / IS NOT NULL are the only correct operators

IN replaces chains of OR — cleaner syntax, identical semantics, often better execution plans

BETWEEN is inclusive on both ends: BETWEEN 10 AND 20 means >= 10 AND <= 20

EXISTS vs IN — when correlated subqueries outperform IN lists on large tables

Sargable predicates: why function-wrapped columns kill indexes and how to fix them

Composite index column order and its relationship to multi-predicate WHERE clauses

WHERE runs in step 3 of 9 — before GROUP BY, HAVING, and SELECT — shaping every downstream operation

Comparison operators =, !=, <>, <, >, <=, >= and their NULL behavior

Logical operators AND, OR, NOT and their precedence rules (AND binds tighter than OR)

NULL is not a value — it is unknown. = NULL never matches. IS NULL / IS NOT NULL are the only correct operators

IN replaces chains of OR — cleaner syntax, identical semantics, often better execution plans

BETWEEN is inclusive on both ends: BETWEEN 10 AND 20 means >= 10 AND <= 20

EXISTS vs IN — when correlated subqueries outperform IN lists on large tables

Sargable predicates: why function-wrapped columns kill indexes and how to fix them

Composite index column order and its relationship to multi-predicate WHERE clauses