SQL Server Interview Question #43

What is the WHERE clause?

SELECT, Filtering, Sorting & Built-in Functions Mid-Level Intermediate

Detailed Explanation

WHERE filters rows before they are returned or processed by later logical query stages. It accepts a predicate that evaluates according to SQL's three-valued logic.

WHERE is used with SELECT, UPDATE, and DELETE. An incorrect predicate in UPDATE or DELETE can modify far more data than intended, so it is especially important in production operations.

Code Example

SELECT Id, Name, Price
FROM dbo.Products
WHERE Price >= 100
  AND IsActive = 1;