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 Company.company_code,Company.founder
,Count(DISTINCT LM.lead_manager_code)
,Count(DISTINCT SM.senior_manager_code)
,Count(DISTINCT M.manager_code)
,Count(DISTINCT E.employee_code)
from Company
Join Lead_Manager As LM on
Company.company_code = LM.company_code
Join Senior_Manager As SM on
LM.company_code=SM.company_code
Join Manager As M on
M.company_code=LM.company_code
Join Employee As E on
E.company_code=M.company_code
Group By Company.company_code,Company.founder
Order BY Company.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 →
MS SQL Server
Select Company.company_code,Company.founder ,Count(DISTINCT LM.lead_manager_code) ,Count(DISTINCT SM.senior_manager_code) ,Count(DISTINCT M.manager_code) ,Count(DISTINCT E.employee_code) from Company Join Lead_Manager As LM on Company.company_code = LM.company_code Join Senior_Manager As SM on LM.company_code=SM.company_code Join Manager As M on M.company_code=LM.company_code Join Employee As E on E.company_code=M.company_code Group By Company.company_code,Company.founder Order BY Company.company_code ASC;