Receive all updates via Facebook. Just Click the Like Button Below

Blogger Widgets
/

Watch Intro About My Website ! ! !

Sunday, 3 November 2013


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

SQL IN Syntax

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

IN Operator Example


The "Persons" table:

Id
LastName
FirstName
Address
City
1
Navis
Anto
Madras
TVL
2
Ji
Bala
Bombay
TVL
3
Christopher
Franklin
America
KK

Now we want to select the persons with a last name equal to "Navis" or "Christopher" from the table above.

We use the following SELECT statement:

SELECT * FROM Persons
WHERE LastName IN ('Navis','Christopher')

The result-set will look like this:

Id
LastName
FirstName
Address
City
1
Navis
Anto
Madras
TVL
3
Christopher
Franklin
America
KK

Tagged:

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...