You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: solution/0100-0199/0181.Employees Earning More Than Their Managers/README_EN.md
+14-34
Original file line number
Diff line number
Diff line change
@@ -43,7 +43,7 @@ Each row of this table indicates the ID of an employee, their name, salary, and
43
43
<p><strongclass="example">Example 1:</strong></p>
44
44
45
45
<pre>
46
-
<strong>Input:</strong>
46
+
<strong>Input:</strong>
47
47
Employee table:
48
48
+----+-------+--------+-----------+
49
49
| id | name | salary | managerId |
@@ -53,7 +53,7 @@ Employee table:
53
53
| 3 | Sam | 60000 | Null |
54
54
| 4 | Max | 90000 | Null |
55
55
+----+-------+--------+-----------+
56
-
<strong>Output:</strong>
56
+
<strong>Output:</strong>
57
57
+----------+
58
58
| Employee |
59
59
+----------+
@@ -68,7 +68,9 @@ Employee table:
68
68
69
69
<!-- solution:start -->
70
70
71
-
### Solution 1
71
+
### Solution 1: Self-Join + Conditional Filtering
72
+
73
+
We can find employees' salaries and their managers' salaries by self-joining the `Employee` table, then filter out employees whose salaries are higher than their managers' salaries.
0 commit comments