473,387 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

i want to know rate of total salary for each department

need to know (%) percentage or rate of each department sahring salary from the total salary

eg total salary is 1000
dept a=200
dept b=350
and dept c=450
eg (then 200/(1000)*100=20%)

select emp.deptno,sum(emp.sal)/sum(e.sal)*100 from emp,emp e
where emp.empno=e.empno
group by emp.deptno

i tried this query but did not worked

hope for early reply

abbas
Mar 30 '07 #1
1 1087
eg total salary is 1000
dept a=200
dept b=350
and dept c=450
eg (then 200/(1000)*100=20%)
Hope this works for you-
Expand|Select|Wrap|Line Numbers
  1. SELECT deptno, (sal/(SELECT SUM(sal) FROM emp))*100 AS percentage
  2. FROM emp 
  3. GROUP BY deptno,sal;
  4.  
Cheers!
Mar 30 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: IHateSuperman | last post by:
import javax.swing.JOptionPane; public class AddStaff{ public static void main(String args){ String StaffName; String StaffCurrPosition; String Salary; String SalaryInDouble; int x;
11
by: reciprocity85 | last post by:
Hello all. I have a question about what you all get paid, and what I should expect in my situation. I googled quite a bit, but not come up with any benchmarks definite enough that I would want...
3
by: satish | last post by:
create table employee(empid int,empname varchar(20),managerid int not null, sal int) insert into employee values(1,'ranga',22,5000) insert into employee values(2,'satish',22,8000) insert into...
1
by: sallyk57 | last post by:
Help with following Programs: Write two programs one where the performance rating here shoud be entered as a int where Excellent =1, Good= 2, Poor=3. an employee who is rated excellent will...
44
by: jiang.haiyun | last post by:
Now i began to learn GUI programming. There are so many choices of GUI in the python world, wxPython, pyGTK, PyQT, Tkinter, .etc, it's difficult for a novice to decide, however. Can you draw a...
14
by: Professor Yonce | last post by:
I have made form for E-Mail. I have entered code but the Import system does not work. It has squiggly line underneath it showing it is not communicating. It Will not build. Public Class...
2
by: fatimahtaher | last post by:
Hi, I am new to C# programming and my first assignment requires me to calculate total interest paid on a loan. The user will input the loan, the interest rate per month, and the monthly payment....
0
by: abbaskhan | last post by:
i need to know (%) percentage or rate of each department sahring salary from the total salary eg total salary is 1000 dept a=200 dept b=350 and dept c=450 eg (then 200/(1000)*100=20%) ...
3
by: Amit Parmar | last post by:
HI Everybody, I have created one table called Employee.this table cantains four columns ID,NAME,DEPTARTMENT,SALARY. Now i want out put in below mentioned format. Emp.ID Emp.Name Dept. ...
1
by: rakeshnair | last post by:
i wrote a code in jsp to create dynamic table..the problem is i need data base connection when cursor moves from one cell to other... eg...when i enter product id in the first cell, the product name...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.