Comparison operators
WHERE can do much more than check whether two values are equal. Comparison operators let you ask for anything above, below or different from a value.
The ones you’ll use:
= equal to
<> not equal to
> greater than
< less than
>= greater than or equal to
<= less than or equal to
Products under 1,000:
SELECT name, price
FROM products
WHERE price < 1000;
Orders placed on or after 1 October 2026:
SELECT order_id, order_date
FROM orders
WHERE order_date >= '2026-10-01';
Dates are written in quotes, and the year-month-day format is the safest choice. Some databases, such as PostgreSQL, also let you write DATE ‘2026-10-01’ to mark the text as a date. SQLite doesn’t accept this, so plain quotes are fine for practice.
Watch the boundary. < 1000 leaves out a product priced at exactly 1,000, while <= 1000 includes it. Many wrong reports come down to this one character.
Many systems also accept != for “not equal”, but <> is the standard form.
Go deeper: SQLite expressions
Which boundary mistake has caught you out in a report?
Join the conversation on LinkedIn