What & Why
Comparison operators (=, <>, >, <, >=, <=) are used in a WHERE clause to compare a column to a value. Comparison operators turn plain business thresholds into SQL filters. They answer questions like above target, below budget, not churned, or launched after a date.
See how it works
Finance wants campaigns above a spend threshold for budget review.
SELECT
name,
channel,
spend
FROM marketing.campaigns
WHERE spend >= 5000
ORDER BY spend DESC;
Syntax pattern
See explanation
WHERE amount > 1000
WHERE status <> 'cancelled'
WHERE created_at >= DATE '2025-01-01'
- = checks equality;
<>and!=check inequality. -
and >= are common for thresholds.
- Compare dates with typed DATE literals for clarity.
Now You Try
Practice this concept hands-on
Run SQL against real datasets right here in the browser and get instant AI feedback. Join the waitlist to get access.
Join the waitlist