Home / Learn Secure SQL / WHERE: Filtering Rows

WHERE: Filtering Rows

Choosing exactly which rows come back.

The gistChoosing exactly which rows come back.

The idea, explained simply

Filter chainall rowsWHERE conditionmatching rows only
Filter chain

In plain terms

WHERE keeps only the rows that match a condition: equality, ranges, text matching, or combinations with AND/OR.

Why we use it

Nearly every security-relevant query is a WHERE clause built from user input, so understanding it precisely matters.

Under the hood

Build conditions from comparisons (=, <, >), combine with AND/OR, and use parentheses to control order.

Real-world use

  • Web application code review
  • Backend development
  • Database administration
Filtering ordersSQL: edit and run

Two conditions combined with AND: both must be true.

Quick quiz

1. AND between two conditions means...