commit 2588c5cb897fe2a2cdbc72beb9a32d757bae9c55 parent 2bcda09999d926ecaeb70731445ce0684a7cb11c Author: AndrewLockVI <andrewlaack1@gmail.com> Date: Wed, 12 Apr 2023 16:36:54 -0500 Complete SQL problem joining table with table to compare values Diffstat:
| A | employees-earning-more-than-managers/employees-earning.sql | | | 8 | ++++++++ |
1 file changed, 8 insertions(+), 0 deletions(-)
diff --git a/employees-earning-more-than-managers/employees-earning.sql b/employees-earning-more-than-managers/employees-earning.sql @@ -0,0 +1,8 @@ +--This goes joins the employees with their managers in the employee table +--and only shows the employees who have a higher salary than their managers +--Speed: 695ms Beats: 68.63% +SELECT E.name as Employee +FROM Employee as E +INNER JOIN Employee as M +ON E.managerId = M.id +WHERE E.salary > M.salary