Filtering with WHERE

Lesson 6 of 20

Teach the engine to say no — watch WHERE test every row against your condition and keep only the survivors.

The big picture

Asking narrower questions

A table can hold thousands of rows. WHERE lets you keep only the ones you care about.

The row filter

WHERE tests a condition on each row. Rows that pass go to the result; the rest are skipped.

Comparison operators

=, <>, < and >= compare values. score >= 85 is true only for strong results.

AND / OR

AND needs both conditions true. OR is satisfied when at least one holds.

Empty is fine

A WHERE that matches nothing returns an empty result — not an error.