We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
SELECT C.company_code, C.founder,
COUNT(DISTINCT LM.lead_manager_code) AS Total Lead Manager,
COUNT(DISTINCT SM.senior_manager_code) AS Total Senior Manager,
COUNT(DISTINCT M.manager_code) AS Total Manager,
COUNT(DISTINCT E.employee_code) AS Total Employee
FROM Company C
LEFT JOIN Lead_Manager LM ON LM.company_code = C.company_code
LEFT JOIN Senior_Manager SM ON SM.company_code = C.company_code
LEFT JOIN Manager M ON M.company_code = C.company_code
LEFT JOIN Employee E ON E.company_code = C.company_code
GROUP BY C.company_code, C.founder
ORDER BY C.company_code ASC;
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
New Companies
You are viewing a single comment's thread. Return to all comments →
SELECT C.company_code, C.founder, COUNT(DISTINCT LM.lead_manager_code) AS
Total Lead Manager
, COUNT(DISTINCT SM.senior_manager_code) ASTotal Senior Manager
, COUNT(DISTINCT M.manager_code) ASTotal Manager
, COUNT(DISTINCT E.employee_code) ASTotal Employee
FROM Company C LEFT JOIN Lead_Manager LM ON LM.company_code = C.company_code LEFT JOIN Senior_Manager SM ON SM.company_code = C.company_code LEFT JOIN Manager M ON M.company_code = C.company_code LEFT JOIN Employee E ON E.company_code = C.company_code GROUP BY C.company_code, C.founder ORDER BY C.company_code ASC;