SQL BETWEEN

SQL BETWEEN used in WHERE clause to get the results based on a range.

SELECT Columns
FROM Tables
WHERE column_name BETWEEN value1 AND value2

Results matching both ‘value1′ and ‘value2′ will be returned in the result set.

Sample:

SELECT Column1
FROM table_name
WHERE column_name  BETWEEN  10 AND 20

SELECT *
FROM table_name
WHERE date_column BETWEEN  ’2009-10-01′ AND ’2010-01-01′

27 views

Return to top