I have a Employee table with columns
ename,eid,salary,deptno. How to retrieve sum of salary for
each deptno?
Answers were Sorted based on User's Feedback
Answer / kavithanedigunta
select deptno,sum(sal) from employee
group by deptno;
| Is This Answer Correct ? | 72 Yes | 4 No |
Answer / vikneswaran
SELECT deptno,SUM(sal) FROM emp
GROUP BY deptno
| Is This Answer Correct ? | 12 Yes | 2 No |
select department_id,sum(salary) Dept_wise_salary,job_id from employees group by department_id,job_id
/
Output
DEPARTMENT_ID DEPT_WISE_SALARY JOB_ID
------------- ---------------- ----------
110 8300 AC_ACCOUNT
90 34000 AD_VP
50 55700 ST_CLERK
80 243500 SA_REP
110 12000 AC_MGR
50 36400 ST_MAN
80 61000 SA_MAN
50 64300 SH_CLERK
20 13000 MK_MAN
90 24000 AD_PRES
60 28800 IT_PROG
DEPARTMENT_ID DEPT_WISE_SALARY JOB_ID
------------- ---------------- ----------
100 12000 FI_MGR
30 13900 PU_CLERK
100 39600 FI_ACCOUNT
70 10000 PR_REP
7000 SA_REP
10 4400 AD_ASST
20 6000 MK_REP
40 6500 HR_REP
30 11000 PU_MAN
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / sudarsan
SELECT
DeptNo AS Department,
Count(DeptNo) AS Dept_Count,
Sum(Salary) AS Salary_DeptWise FROM Employee
GROUP BY DeptNo
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / radheshyam mali
Select sum(salary) from Employee group by deptno
| Is This Answer Correct ? | 6 Yes | 10 No |
Answer / lova raju allumalla
instead of deptno the result will give u in department name
select sum(sal),dname from emp e,dept d where
e.deptno=d.deptno group by dname
/
| Is This Answer Correct ? | 0 Yes | 4 No |
Answer / madhusudan darshannkar
SELECT COUNT(EID) AS EMPLOYEE,DEPTNON,SUM(SALARY) FROM
EMPLOYEE GROUP BY DEPTNO
| Is This Answer Correct ? | 4 Yes | 12 No |
What are sql commands?
What is character functions?
What is the different between Stored Procedure and Procedure?
What are the operators in sql?
How do I truncate a sql log file?
Does sql between include endpoints?
What are the usage of SAVEPOINTS?
What are the return values of functions SQLCODE and SQLERRM ?
Table name: T1, it has only one column. col1 ------ c b a b b b b d s a a t s Requirement: I need the following output from the above base table by using SQL query. col1 Cnt ----- ------- a 3 b 5 Others 5 Please help. Thanks Guru v.gurus@in.com
I want to know last five transactions or records from emp table, from now?
define a variable representing the expression used to calculate on emps total annual remuneration.use the variable in a statement which finds all emps who can earn 30000 a year or more.
What is dcl in sql?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)