Learn SQL Lesson

WHERE Clause Basics

The `WHERE` clause filters rows based on a condition. Only rows that satisfy the condition are included in the result:

SELECT * FROM employees WHERE department = 'Engineering'

This returns only employees in the Engineering department.

Common comparison operators: = Equal to != Not equal to (also written <>) > Greater than < Less than >= Greater than or equal to <= Less than or equal to

For text values, remember to wrap them in single quotes: `'Engineering'`.

Practice challenge

Find all employees with a salary greater than 80,000.

Open interactive editor