CBSE Class 12 Informatics Practices Question 73 of 90

Querying Using SQL — Question 13

Back to all questions
13
Question

Question 13

Show the average salary for all departments with more than 3 people for a job.

Answer
SELECT job, AVG(Sal) AS AvgSalary 
FROM Empl 
GROUP BY job HAVING COUNT(*) > 3;
Output
+----------+-----------+
| job      | AvgSalary |
+----------+-----------+
| CLERK    |    1037.5 |
| SALESMAN |      1400 |
+----------+-----------+