LoginSignup
0
1

More than 3 years have passed since last update.

[SQL] LeetCodeの無料問題集を活用して、SQLを使いこなし(5)

Posted at

181 Employees Earning More Than Their Managers

Q181.png

質問

Employeeテーブルは、従業員のID、給料と彼らのマネージャーIDを含まれています。
Employeeで給料はマネージャーより高い従業員を探します。

Code

SELECT a.NAME as Employee
FROM Employee a
LEFT JOIN Employee b
ON a.ManagerID=b.ID
WHERE a.Salary>b.Salary

Result

Q181_result.png

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1