Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: help me with the query
maruf.syfullah_at_gmail.com schrieb:
> 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.
>
It requires the very basical knowledge of SQL. Have you tried to solve it at all?
Best regards
Maxim Received on Thu May 17 2007 - 09:31:01 CDT