<> means 'is not this'
Starting table: orders
| id | status |
|---|---|
| 101 | completed |
| 102 | cancelled |
| 103 | ready |
| 104 | NULL |
<> means 'is not equal to': rows with that value are left out, everything else appears in your results. <> is the ANSI standard spelling; != isn't in the standard, but nearly every database accepts it too. Heads up: rows with a blank cell (NULL) are skipped too, since SQL can't compare what isn't recorded.
A tiny example
In plain English: Show me the id and status of orders whose status is not cancelled.
SELECT id, status
FROM orders
WHERE status <> 'cancelled';Query result
| id | status |
|---|---|
| 101 | completed |
| 103 | ready |
101 (completed) and 103 (ready) appear in your results. 102 is cancelled, so it is excluded. 104 has a NULL status, so SQL cannot confirm it is not cancelled and excludes it too.
Related SQL lessons
Practice <> step by step
The Foundations Track has beginner puzzles built around this idea. Tap tiles, see real results. No terminal, no setup.
practice this in the courseReady for a break?
A fresh, bite-sized SQL puzzle waits every morning. Tap tiles, see real results. No terminal, no setup, no timers.
Try today's free SQL puzzle