Leakbali
w3 Tutorial, Web Tutorial
Register   Login
Share

MySQL IN Operator 


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

MySQL IN Syntax

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

MySQL IN Operator Example

The "Persons" table:
IDFirst NameLast NameAddress
1PutuSanjayaDenpasar
2MadeSanjayaSanur
3HaruSanjayaGianyar
Now we want to select the persons with a last name equal to "Putu" or "Haru" from the table above. We use the following SELECT statement:
SELECT * FROM Persons WHERE FirstName IN ('Putu','Haru')
The result-set will look like this:
IDFirst NameLast NameAddress
1PutuSanjayaDenpasar
3HaruSanjayaGianyar
More Tutorial
  1. MYSQL - MySQL IN Operator

References

About Us

Home
About Us
Contact Us
Sitemap

Tools

Google PageRank
Alexa Rank
Keywords Density

Accounts

Register Account
Login
Valid XHTML 1.0 TransitionalValid CSS!
Web Directory


2006 - 2012 © Leakbali.com - Free Web Tutorial, Free Web Articles, Web Sharing, Source Codes, Web References