leetcode

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

0185.sql (280B)


      1 SELECT D.name AS 'Department', 
      2        E.name AS 'Employee', 
      3        E.salary AS 'Salary' 
      4 FROM Employee E
      5 JOIN Department D
      6 ON E.departmentId = D.id 
      7 WHERE 3 > (
      8     SELECT COUNT(DISTINCT salary)
      9     FROM Employee
     10     WHERE salary > E.salary AND E.departmentId = departmentId
     11 );