Range Conditions Using the BETWEEN Operator

Using the BETWEEN Operator

Use the BETWEEN operator to display rows based on a range of values.You can display rows based on a range of values using the BETWEEN operator. The range that you specify contains a lower limit and an upper limit.

             SELECT last_name, salary
             FROM employees
             WHERE salary BETWEEN 2500 AND 3500 ;


The SELECT statement in the example returns rows from the EMPLOYEES table for any employee
whose salary is between 2500 and 3500.
Values that are specified with the BETWEEN operator are inclusive. However, you must specify the
lower limit first.

You can also use the BETWEEN operator on character values. 

               SELECT last_name
               FROM employees
               WHERE last_name between 'King' and 'Smith';



No comments:

Post a Comment