BETWEEN Operator - ( Oracle Misc )
The BETWEEN
operator is used in Oracle SQL to find values within a specified range. The BETWEEN
operator is inclusive, meaning that it includes the start and end values in the range.
Syntax
The syntax for the BETWEEN
operator in Oracle SQL is:
SELECT column_name(s)
FROM table_name
WHERE column_name BETWEEN value1 AND value2;
Here, column_name
is the name of the column to search for values, table_name
is the name of the table to search in, value1
is the starting value of the range, and value2
is the ending value of the range.
Example
SELECT *
FROM employees
WHERE salary BETWEEN 50000 AND 70000;
In the above example, we are selecting all columns from the employees
table where the salary
column is between 50000
and 70000
inclusive.
Output
The output of the query will be a list of all employees whose salary falls within the specified range.
Explanation
The BETWEEN
operator is used to search for values within a specified range. In the above example, we are searching for all employees whose salary falls within the range of 50000
to 70000
inclusive.
Use
The BETWEEN
operator is commonly used in SQL queries to search for data within a specific range. It is often used with numeric or date values, but can also be used with string values.
Important Points
- The
BETWEEN
operator is used in Oracle SQL to search for values within a specified range. - The
BETWEEN
operator is inclusive, meaning that it includes the start and end values in the range. - The
BETWEEN
operator can be used with numeric, date, and string values.
Summary
In summary, the BETWEEN
operator is a useful tool in Oracle SQL for searching for values within a specified range. It is inclusive, meaning that it includes the start and end values in the range. The BETWEEN
operator is commonly used with numeric or date values, but can also be used with string values.