CBSE Class 12 Computer Science Question 86 of 91

Grouping Records, Joins in SQL — Question 21

Back to all questions
21
Question

Question 20

List the maximum salary of employee grouped by their department number.

Answer
SELECT deptno, MAX(sal) AS max_salary
FROM EMPL
GROUP BY deptno;
Output
+--------+------------+
| deptno | max_salary |
+--------+------------+
|     20 |       3000 |
|     30 |       2850 |
|     10 |       5000 |
+--------+------------+