CBSE Class 12 Informatics Practices Question 77 of 90

Querying Using SQL — Question 17

Back to all questions
17
Question

Question 17

List the sum of employees' salaries grouped by department. (table EMPL)

Answer
SELECT deptno, SUM(sal) AS total_salary
FROM EMPL
GROUP BY deptno;
Output
+--------+--------------+
| deptno | total_salary |
+--------+--------------+
|     20 |        10885 |
|     30 |         9400 |
|     10 |         8750 |
+--------+--------------+