hi good day!
3 Replies - 1054 Views - Last Post: 10 August 2012 - 04:17 PM
#1
getting highest paid employee and lowest paid employee using pl/sql
Posted 09 August 2012 - 09:19 PM
Replies To: getting highest paid employee and lowest paid employee using pl/sql
#2
Re: getting highest paid employee and lowest paid employee using pl/sql
Posted 09 August 2012 - 09:26 PM
hi good day!
i just wanna ask how to get the highest and lowest paid employee from temp3_emp table. i have here the codes:
but then, i only get the names and the salary.. wherein, i have to declare who is the highes paid employee and the lowest paid employee..
here's the output:
ENAME SAL
---------- ----------
SMITH 800
KING 5000
any one who can help?. thanks a lot..
i just wanna ask how to get the highest and lowest paid employee from temp3_emp table. i have here the codes:
select ename, sal from temp3_emp where sal = (select max(sal)highest_paid from temp3_emp) or sal = (select min(sal)least_paid from temp3_emp);
but then, i only get the names and the salary.. wherein, i have to declare who is the highes paid employee and the lowest paid employee..
here's the output:
ENAME SAL
---------- ----------
SMITH 800
KING 5000
any one who can help?. thanks a lot..
#3
Re: getting highest paid employee and lowest paid employee using pl/sql
Posted 10 August 2012 - 05:54 AM
perhaps using a union statement to make it look a little nicer 
select ename, max(sal) from temp3_emp union select ename, min(sal) from temp3_emp
#4
Re: getting highest paid employee and lowest paid employee using pl/sql
Posted 10 August 2012 - 04:17 PM
hi sir.. how about getting the highest and lowest paid employee each month?.
i have the query like this:
but the output is:
OUTPUT:
HIREDATE HIGHEST_SALARY LOWEST_SALARY
-------------------- -------------- -------------
JAN-01-2012 14:23:01 2850 800
APR-01-2012 14:23:01 1100 1100
NOV-01-2012 14:23:01 1250 1250
OCT-01-2012 14:23:01 2975 2975
MAR-01-2012 14:23:01 950 950
SEP-01-2012 14:23:01 1250 1250
AUG-01-2012 14:23:01 2450 2450
JUL-01-2012 14:23:01 3000 3000
JUN-01-2012 14:23:01 5000 5000
MAY-01-2012 14:23:01 1500 1500
FEB-01-2012 14:23:01 3000 1300
but based on the instruction, i have to display also the ename, hiredate of each month and the highest and lowest salary..
what are the missing parameters?.
thanks..
i have the query like this:
select hiredate, max(sal) highest_salary, min(sal)lowest_salary from temp3_emp group by hiredate;
but the output is:
OUTPUT:
HIREDATE HIGHEST_SALARY LOWEST_SALARY
-------------------- -------------- -------------
JAN-01-2012 14:23:01 2850 800
APR-01-2012 14:23:01 1100 1100
NOV-01-2012 14:23:01 1250 1250
OCT-01-2012 14:23:01 2975 2975
MAR-01-2012 14:23:01 950 950
SEP-01-2012 14:23:01 1250 1250
AUG-01-2012 14:23:01 2450 2450
JUL-01-2012 14:23:01 3000 3000
JUN-01-2012 14:23:01 5000 5000
MAY-01-2012 14:23:01 1500 1500
FEB-01-2012 14:23:01 3000 1300
but based on the instruction, i have to display also the ename, hiredate of each month and the highest and lowest salary..
what are the missing parameters?.
thanks..
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote



|