In short
Equal to, greater than, not equal: six small operators do most of the filtering work in SQL. They behave nicely on numbers, and hold a few surprises on text, dates and NULL.
Comparison operators (=, <> or !=, <, >, <=, >=) compare a column with a value or another column. They work on numbers, text and dates, and any comparison with NULL gives UNKNOWN, not true or false.

Think of it like this
The sabzi mandi scale
A vendor puts tomatoes on one pan and a 1 kg weight on the other. Heavier, lighter or exactly equal? Every comparison operator is that balance: it puts a column on one side, a value on the other, and answers yes or no.
Watch it happen
Order amounts tested with different operators
1/5Five order amounts in rupees.
The big ideas
What you need to know
The six operators
= equal, <> or != not equal, <, >, <= and >=. <> is the standard; != works in most databases too.
Dates compare in time order
order_date < DATE '2026-04-01' means before April. Use real DATE columns, not text.
Text compares alphabetically
'Agra' < 'Pune' is TRUE. But '10' < '9' is also TRUE as text, so keep numbers in number columns.
NULL never compares
amount = NULL and amount <> 500 both give unknown for a NULL amount. Use IS NULL.
See it in code
Walk through the code
1SELECT order_id, amount, order_date2FROM orders3WHERE amount >= 500;4 5SELECT order_id, status6FROM orders7WHERE status <> 'cancelled';8 9SELECT order_id, order_date10FROM orders11WHERE order_date < DATE '2026-04-01';12 13SELECT product_name, mrp, selling_price14FROM products15WHERE selling_price < mrp;1/4Orders of ₹500 or more. >= includes the boundary.
Comparisons against values, text, dates and even another column. All four run in PostgreSQL and MySQL.
Save yourself the pain
Common mistakes
Oops
Using > 500 when the request said "₹500 and above".
Do this instead
"And above" means >=. Read the boundary in the question carefully.
Oops
Storing pincode or amount as text and comparing with < or >.
Do this instead
Text compares character by character. Store numbers as numbers or CAST before comparing.
Your mission
Weigh your rows
Quick check
Which condition keeps orders of ₹1,000 but not ₹999?
Go deeper
- 1Find orders above a certain amount and orders placed after a certain date.
- 2Compare text with < and > and notice it follows alphabetical (collation) order.
- 3Try WHERE column = NULL and see why it returns no rows.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.