0

I'm stuck on this problem any one know the answer.

**Write a query that displays the grade of all employees based on the value of the column JOB,
as per the table shown below. Order the result according to the grade! **

JOB GRADE
PRESIDENT A
MANAGER B
ANALYST C
SALESMAN D
CLERK E
None of them above O

This should be the output

JOB G
--------- -
PRESIDENT A
MANAGER B
MANAGER B
MANAGER B
ANALYST C
ANALYST C
SALESMAN D
etc.

The database I'm using is EMP and JOB is a column within EMP

2
Contributors
2
Replies
17
Views
3 Years
Discussion Span
Last Post by theashman88
0

I figured it out, but just to let you know grade wasn't a column

select JOB, 
case JOB 
when 'PRESIDENT' then 'A' 
when 'MANAGER' then 'B' 
< other when then > 
else 'O' 
end as GRADE 
from EMP 
order by 
case JOB 
when 'PRESIDENT' then 'A' 
when 'MANAGER' then 'B' 
< other when then > 
else 'O' 
end 
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.