By 25/02/2016 2 Comments

What Is BETWEEN Operator In SQL?

  • The BETWEEN operator retrieves/selects values within a range.
  • The BETWEEN operator can be used with WHERE clause.
  • The BETWEEN operator can selects/retrieves the range of numbers, dates or text data type values in database table.

Syntax:

SELECT column_name(s)
FROM table_name
WHERE column_name BETWEEN value_1 AND value_2;

Example-1: BETWEEN Operator with text/string type values

SELECT *
FROM products
WHERE p_name BETWEEN 'l' AND 'p';

Example-2: BETWEEN Operator with number type values

SELECT *
FROM products
WHERE price BETWEEN 700 AND 1501;

Example-3: BETWEEN Operator with date type values

SELECT *
FROM products
WHERE p_date BETWEEN '2016-01-06' AND '2016-03-08';

Example-4: BETWEEN Operator with IN Operator

SELECT *
FROM products
WHERE (price BETWEEN 1000 AND 1600)
AND p_name IN('laptop', 'iron');






← Previous Tutorial


Posted in: Sql

Leave your valuable Comment

Have a natural attraction for women cosmetics and replica watches uk clothes, no
more than two for men the most attractive one, is to make their own driving experience, happy and can serve as the facade of the car, another is to highlight the taste edify sentiment rolex replica watch. The replica rolex is undoubtedly the most fashionable accessories, wear a suit to attend the activities, but also get a decent match on the replica watches .