Specifies the search condition for the rows returned by the query.
Transact-SQL Syntax Conventions
[ WHERE <search_condition> ]
Defines the condition to be met for the rows to be returned. There is no limit to the number of predicates that can be included in a search condition. For more information about search conditions and predicates, see Search Condition (Transact-SQL).
The following examples show how to use some common search conditions in the WHERE clause.
WHERE
USE AdventureWorks GO SELECT ProductID, Name FROM Production.Product WHERE Name = 'Blade' ; GO
SELECT ProductID, Name, Color FROM Production.Product WHERE Name LIKE ('%Frame%') GO
SELECT ProductID, Name FROM Production.Product WHERE ProductID <= 12 ; GO
SELECT ProductID, Name FROM Production.Product WHERE ProductID = 2 OR ProductID = 4 OR Name = 'Spokes' ; GO
SELECT ProductID, Name, Color FROM Production.Product WHERE Name LIKE ('%Frame%') AND Name LIKE ('HL%') AND Color = 'Red' ; GO
SELECT ProductID, Name, Color FROM Production.Product WHERE Name IN ('Blade', 'Crown Race', 'Spokes'); GO
SELECT ProductID, Name, Color FROM Production.Product WHERE ProductID BETWEEN 725 AND 734; GO