Question discussion

What does the following query return? SELECT Dept, COUNT(*) FROM Employees GROUP BY Dept HAVING COUNT(*) = (SELECT MAX(cnt) FROM (SELECT CO…

521Medium DSSSB TGT Computer Science 0 replies 1 views
0
What does the following query return? SELECT Dept, COUNT(*) FROM Employees GROUP BY Dept HAVING COUNT(*) = (SELECT MAX(cnt) FROM (SELECT COUNT(*) AS cnt FROM Employees GROUP BY Dept) AS T);
  • AThe department(s) with the maximum number of employees
  • BThe department with the minimum number of employees
  • CThe total number of employees in all departments
  • DA syntax error, as nested subqueries with GROUP BY are not allowed
Correct answer: A

Discussion 0

Nobody has replied yet. Start the discussion!