3 Replies - 1945 Views - Last Post: 10 August 2012 - 04:17 PM Rate Topic: -----

#1 jeffreyjane  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 08-August 12

getting highest paid employee and lowest paid employee using pl/sql

Posted 09 August 2012 - 09:19 PM

hi good day!
Is This A Good Question/Topic? 0
  • +

Replies To: getting highest paid employee and lowest paid employee using pl/sql

#2 jeffreyjane  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 08-August 12

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:

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.. :)
Was This Post Helpful? 0
  • +
  • -

#3 Luckless  Icon User is offline

  • </luck>
  • member icon

Reputation: 292
  • View blog
  • Posts: 1,146
  • Joined: 31-August 09

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 :bigsmile:

select ename, max(sal) from temp3_emp
union
select ename, min(sal) from temp3_emp



Was This Post Helpful? 1
  • +
  • -

#4 jeffreyjane  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 08-August 12

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:

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.. :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1