How are these two codes different from each other. Although the result is same. #10
Unanswered
Purushotham-m16
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to extract name of employee who is reported by 5 or more employees on leetcode:
Accepted code:
SELECT
EMP1.name
FROM Employee AS EMP1
JOIN(
SELECT managerId
FROM Employee
GROUP BY managerId
HAVING COUNT(managerId) >= 5
) AS EMP2
ON EMP1.id = EMP2.managerId
Rejected code:
SELECT name
FROM Employee
HAVING COUNT(managerId) >= 5
Beta Was this translation helpful? Give feedback.
All reactions