CHAPTER 4
WHERE filters which rows come back. Without it, you get every row.
🌟 Think of it this way: WHERE is the bouncer at the door. Only rows that satisfy the condition get through to your result. Everyone else it turned away.
SQL
SELECT name, department, salary FROM employees WHERE department = 'IT';
| OPERATOR | MEANING | EXAMPLE |
|---|---|---|
| = | Exact equal | department = 'IT' |
| != or <> | Not equal | status != 'completed' |
| > | Greater than | salary > 70000 |
| < | Less than | salary < 60000 |
| >= | Greater than or equal | slalary >= 72000 |
| <= | Less than or equal | salary <= 62000 |
Find employees more than 70000
SELECT name, salary FROM employees WHERE salary > 70000;