-
NEW Companies<HackerRank> 2023. 7. 14. 21:13728x90
NEW Companies
-- MYSQL SELECT e.company_code, c.founder, count( DISTINCT e.lead_manager_code ), count( DISTINCT e.senior_manager_code ), count( DISTINCT e.manager_code ), count( DISTINCT e.employee_code ) FROM Employee e, Company c WHERE e.company_code = c.company_code GROUP BY company_code, founder;
728x90-- oracle, db2 select c.company_code, c.founder, count(distinct e.lead_manager_code), count(distinct e.senior_manager_code), count(distinct e.manager_code), count(distinct e.employee_code) from employee e join company c on e.company_code = c.company_code group by c.company_code, c.founder order by c.company_code;
-- MS SQL Server SELECT C.company_code , C.founder , COUNT(DISTINCT(E.lead_manager_code)) , COUNT(DISTINCT(E.senior_manager_code)) , COUNT(DISTINCT(E.manager_code)) , COUNT(DISTINCT(E.employee_code)) FROM Company C LEFT JOIN Employee E ON E.company_code = C.company_code GROUP BY C.company_code, C.founder ORDER BY C.company_code ASC;
728x90'<HackerRank>' 카테고리의 다른 글
Weather Observation Station 19 (0) 2023.07.19 Weather Observation Station 18 (0) 2023.07.17 Binary Tree Nodes (0) 2023.07.12 The PADS (0) 2023.07.10