Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> help me with the query
Consider a database table 'employee_salary'. Table schema is as
follows -
create table employee_salary(
employeename varchar(20),
salary integer
);
The inserted data are as follows -
Employeename | salary
-------------------|-------- a | 2300 b | 1000 c | 3500 d | 3100 e | 2000
Your objective is to construct a SINGLE QUERY which will produce the following output -
employeename | salary | percent
-------------------|--------|----------- a | 2300 | 19.08 b | 1000 | 16.03 c | 3500 | 11.45 d | 3100 | 38.17 e | 2000 | 15.27 total | 11900 | 100.00
The last row of the output indicates the total sum of salaries. The column 'percent' indicates the percentage of the associated employees' salary out of the total salary. Received on Thu May 17 2007 - 09:07:41 CDT
![]() |
![]() |