Header Ads

Header ADS

Range Conditions Using the BETWEEN Operator

Range Conditions Using the BETWEEN Operator

Topic Introduction: In this tutorial, we will discuss Oracle SQL Range Conditions Using the BETWEEN Operator. Use the BETWEEN operator to display rows based on a range of values. here specify to value first value is lower and the second is upper. the value can be a number, date, character, etc.

Syntex
Where column/expression between lower_value and upper_value

Example 1
select last_name,hire_date,salary
from employees
where salary  between 10000 and 15000;

In example 1 we give a range of conditions by salary column which contains numeric values. that to find out the employee list whose salary range is 10000 to 15000.

Example 2
select last_name,hire_date,salary
from employees
where hire_date between '01-JAN-03' and '31-DEC-03';

In example 2 we give a range of conditions by the hire_date column which contains date values. that to find out the employee list who joined between 01-JAN-03 to 31-DEC-03 means in the 2003 year.

Example 3
select last_name,hire_date,salary
from employees
where last_name between 'Ande' and 'Davies';

In example 3 we give a range of conditions by the last_name column which contains character values. that to find out the employee list whose name range from Ande to Davies this consider order by lower and upper value.


Note 1. If characters or dates are used in the condition values, they must be enclosed with single quotation marks ('').

No comments

Theme images by Deejpilot. Powered by Blogger.