Home » SQL & PL/SQL » SQL & PL/SQL » Resolved
Resolved [message #217456] Fri, 02 February 2007 05:45 Go to next message
khan05
Messages: 2
Registered: February 2007
Junior Member
Hi Guys

I am having some trouble with my queries Embarassed

the first query i got is

from my emp table using colums sal and com. compute the average annual slalary + comm for all salesmen which is in colum job.

I want it to be displayed like this below

Compensataion
--------------
5000

Also

from the emp table colum sal how would i find out the highest and lowest paid employee and the difference beween them and display them like

Rich Poor Differnce
------- ----- ---------
5000 200 4800

[Updated on: Fri, 02 February 2007 06:24]

Report message to a moderator

Re: Query Function help [message #217459 is a reply to message #217456] Fri, 02 February 2007 05:57 Go to previous messageGo to next message
haikasi
Messages: 7
Registered: October 2006
Junior Member
1.
select avg(tot) from (select sal+nvl(comm,0) tot from emp where job='SALESMAN')

2.
select max(sal) rich, min(sal) poor, max(sal)-min(sal) difference
from emp
icon14.gif  Resolved [message #217460 is a reply to message #217459] Fri, 02 February 2007 06:08 Go to previous message
khan05
Messages: 2
Registered: February 2007
Junior Member
Thanks haikasi
Previous Topic: How to find how many occurences of every ID in table
Next Topic: problem in procedure
Goto Forum:
  


Current Time: Sat Dec 03 18:20:02 CST 2016

Total time taken to generate the page: 0.09806 seconds