SQL IN Operator

Thursday, November 17, 2011

tags SQL

The IN operator is used in a WHERE clause. It allows you to specify multiple values.


Syntax

SELECT column_name(s)
FROM table_name
WHERE column_name IN (value1,value2,...)


Example

Search for records that contain 'Joe', 'Fred' or 'Tim' in the column 'firstName'.


SELECT * FROM Customers
WHERE firstName IN ('Joe','Fred', 'Tim')

Did you find the page informational and useful? Share it using one of your favorite social sites.

Recommended Books & Training Resources

Head First SQL: Your Brain on SQL A Learners Guide SQL Cookbook