Employee management exercise 12

Back to Employee management

Select the departments with a budget larger than the average budget of all the departments.

| SELECT code, name, budget FROM departments
| COPY
| GROUP budget AVG
| CROSS
| WHERE budget $> budget-avg
1 row 0 msec
budget-avg code name budget
93750 59 Human Resources 240000


The $ modifier allows to compare with another column in the tuple and not a constant. The right side can also be an expression in RPN form.