The WHERE clause filters rows by evaluating a condition. Only rows that satisfy the condition are returned or affected.
Filtering is one of the most important SQL skills because business questions usually require only a specific portion of the available data.
Find employees who work in the Finance department.
SELECT
EmployeeName,
Department,
Salary
FROM Employees
WHERE Department = 'Finance';
WHERE is used in reporting, data analysis, customer filtering, transaction analysis, compliance checks, and operational reporting.
- WHERE filters rows.
- It evaluates a condition.
- Only matching rows are returned.
- It can use operators and logical conditions.
- It is commonly used with SELECT, UPDATE, and DELETE.
What is the purpose of WHERE?
WHERE filters rows based on a specified condition.
Can WHERE be used with UPDATE and DELETE?
Yes. WHERE can restrict which rows are updated or deleted.