programming-examples/sql/SubqueriesHRDatabase/Write a query in SQL to display the full name (first and last name) of manager who is supervising 4 or more employees.sql

10 lines
409 B
MySQL
Raw Normal View History

2019-11-18 14:05:53 +01:00
/*Write a query in SQL to display the full name (first and last name) of manager who is supervising 4 or more employees.
*/
SELECT first_name || ' ' || last_name AS Manager_name,department_id
FROM employees
WHERE employee_id IN
(SELECT manager_id
FROM employees
GROUP BY manager_id
HAVING COUNT(*)>=4);