SQL BETWEEN CLAUSE



The BETWEEN operator is used to select values within a range.
The BETWEEN operator selects values within a range. The values can be numbers, text, or dates.

SYNTAX:

SELECT column1, column2....columnN
FROM   table_name
WHERE  column_name BETWEEN val-1 AND val-2;

EXAMPLE:

SELECT * FROM student
WHERE mark1 BETWEEN 30 AND 40;

Displays all the columns from the table student with mark1 between 30 and 40.

SELECT * FROM Products
WHERE ProductName BETWEEN 'C' AND 'M';

Displays all the products with name c to m.

No comments:

Post a Comment