Suppose you have a table named Employee with the following rows:
ID NAME SALARY
100 Dave 55600.00
200 James 53400.00
300 Rose 65000.00
400 Jenny 68000.00
The following SQL statement shows you how to group by a calculated column.
select ((trunc(salary/10000) * 10000) || ' -' || ((trunc(salary/10000) +1) * 10000)) as Salary_Range,
count(*)
from employee
group by
((trunc(salary/10000) * 10000) || ' - ' || ((trunc(salary/10000) +1) * 10000))
The result is to show how many employees threre are in each salary range:
SALARY_RANGE COUNT(*)
50000 - 60000 2
60000 - 70000 2