Using BETWEEN
To retrieve rows from a table where the values of one column fall in a range of values, use BETWEEN. BETWEEN selects all rows that have values in between and equal to the starting and ending values of the specified range.
Example
List the ID, job class, and salary of all employees who earn from $33,000 to $39,000:
select empid, class, salary from emp where salary between 33000 and 39000 order by salary ! display
EMP REPORT mm/dd/yy EMPID CLASS SALARY ───── ───── ─────────── 0024 42 33000.00 0027 42 33000.00 0029 42 33000.00 0158 42 34000.00 0028 42 34500.00 0019 43 37000.00 0476 33 37000.00 0035 43 37500.00 0149 33 39000.00 END OF REPORT
|
Copyright © 2013 CA.
All rights reserved.
|
|