Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> help me with the query

help me with the query

From: <maruf.syfullah_at_gmail.com>
Date: 17 May 2007 07:07:41 -0700
Message-ID: <1179410861.136633.169270@q23g2000hsg.googlegroups.com>


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

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US