Comparisons
Most questions are about some rows: the products in one category, the customers who joined this
year. WHERE keeps only the rows that match a condition:
SELECT name, list_price
FROM products
WHERE category = 'Furniture'WHERE goes after FROM. The comparisons you can use are:
| Symbol | Means |
|---|---|
= | equal to |
<> | not equal to (!= works too) |
< and > | less than, greater than |
<= and >= | less than or equal, greater than or equal |
Text, numbers and dates
- Text goes in single quotes, and must match exactly, including capitals:
'Furniture'isn't the same as'furniture'. - Numbers don't need quotes:
list_price > 50. - Dates are written as text in year-month-day order:
signup_date >= '2026-01-01'means "on or after 1 January 2026". Year first is the international standard, and every database understands it.