CadencePlus Solutions

WHERE and comparison operators

WHERE keeps the individual rows that meet your conditions. Start with one rule, then combine rules deliberately.

Comparisons

Use = for equality, <> for inequality, and >, >=, < or <= for ranges. Text literals need single quotes. WHERE status = 'paid' compares a column with a text value.

AND, OR and NOT

AND requires both conditions; OR requires at least one. AND binds more tightly than OR, so use parentheses when mixing them. NOT reverses a condition, but NULL still introduces an unknown result.

BETWEEN

BETWEEN includes both endpoints. It is convenient for numeric ranges. With timestamps, an exclusive upper boundary is often safer than assuming a whole day ends at midnight.

IN

IN checks membership in a list: country IN ('Canada', 'UK'). A list is not a subquery. A nested SELECT can also supply that list; you will meet that pattern at Intermediate.