Beginner

165. WHERE Clause

Learn how the WHERE clause filters rows based on specified conditions.

📘 Lesson 165 of 728 ⏱ 8 min 🎯 Beginner

The WHERE clause restricts the rows returned or affected by a SQL statement based on one or more conditions.

Filtering is one of the most important SQL operations because analysts rarely need every record in a large database.

An analyst can retrieve only employees who belong to the Finance department.

SQL
SELECT
    EmployeeName,
    Department,
    Salary
FROM Employees
WHERE Department = 'Finance';

WHERE is used for date filters, department filters, customer segmentation, transaction analysis, compliance checks, and business reporting.

  • WHERE filters rows.
  • It can use comparison operators.
  • Multiple conditions can be combined.
  • It is used with SELECT, UPDATE, and DELETE.
  • Filtering can significantly reduce the result set.
What is the purpose of WHERE?

WHERE filters rows according to one or more specified conditions.

Can WHERE be used with UPDATE and DELETE?

Yes. WHERE can restrict which rows are updated or deleted.

Have you finished this lesson?

Introduction to SQL – All Lessons