leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

1731.sql (275B)


      1 SELECT M.employee_id,
      2        M.name,
      3        COUNT(E.employee_id) AS reports_count,
      4        ROUND(AVG(E.age), 0) AS average_age
      5 FROM Employees M
      6 LEFT JOIN Employees E
      7 ON M.employee_id = E.reports_to
      8 GROUP BY M.employee_id
      9 HAVING COUNT(E.employee_id) > 0
     10 ORDER BY M.employee_id