Medium 2

 avatar
Manishyadav514
mysql
2 years ago
511 B
1
Indexable
Never
SELECT C.company_code, C.founder,
  (SELECT COUNT(DISTINCT lead_manager_code)
   FROM LEAD_MANAGER L
   WHERE L.COMPANY_CODE = C.company_code),
  (SELECT COUNT(DISTINCT SENIOR_MANAGER_CODE)
   FROM SENIOR_MANAGER S 
   WHERE S.company_code = C.company_code),
  (SELECT COUNT(DISTINCT manager_code)
   FROM MANAGER M
   WHERE M.company_code = C.company_code),
  (SELECT COUNT(DISTINCT EMPLOYEE_CODE)
   FROM EMPLOYEE E WHERE E.company_code = C.company_code)
FROM COMPANY C
ORDER BY C.company_code;