Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Aggregate Function with Case Statement

User_YBJTMJul 9 2022

Hi,
I needed to print salary along with extended column which stating where EACH salary is below, above or on the average salary. Here is my code:
select salary,
case when salary < avg(salary) then 'Below Average'
when salary = avg(salary) then 'On Average'
when salary > avg(salary) then 'Above Average'
else 'NA'
end result_avg
from employees;
Thanks for your support in advance.

This post has been answered by Frank Kulash on Jul 9 2022
Jump to Answer
Comments
Post Details
Added on Jul 9 2022
1 comment
1,029 views