Leakbali
w3 Tutorial, Web Tutorial
Switch to English Bahasa Indonesia 
Register   Login

MySQL - Between


The BETWEEN operator is used in a WHERE clause to select a range of data between two values. The BETWEEN operator selects a range of data between two values. The values can be numbers, text, or dates.

SQL BETWEEN Syntax

SELECT column_name(s)
FROM table_name
WHERE column_name
BETWEEN value1 AND value2

MySQL Between Example

The "Persons" table:
IDFirst NameLast NameAddress
1PutuSanjayaDenpasar
2MadeSanjayaGianyar
3HaruSanjayaSanur
Now we want to select the persons with a first name alphabetically between "Komang" and "Haru" from the table above.

We use the following SELECT statement:
SELECT * FROM Persons
WHERE FirstName
BETWEEN 'Putu' AND 'Haru'
The result-set will look like this:
IDFirst NameLast NameAddress
3HaruSanjayaSanur

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