Write a query in SQL to list the name of the managers who is having maximum number of employees working under him
- برمجة سي كيو ال sql
- 2021-09-07
- mhanasmh00489829403
الأجوبة
SELECT m.emp_name,
count(*)
FROM employees w,
employees m
WHERE w.manager_id = m.emp_id
GROUP BY m.emp_name
HAVING count(*) =
(SELECT MAX (mycount)
FROM
(SELECT COUNT(*) mycount
FROM employees
GROUP BY manager_id) a);
Sample Output:
emp_name | count ----------+------- BLAZE | 5 (1 row)
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال