File tree 1 file changed +31
-0
lines changed
1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -426,4 +426,35 @@ WHEN product_id NOT IN
426
426
FROM products
427
427
WHERE change_date <= ' 2019-08-16'
428
428
)
429
+ ```
430
+
431
+
432
+ [ 1978. Employees Whose Manager Left the Company] ( https://leetcode.com/problems/employees-whose-manager-left-the-company )
433
+ ``` sql
434
+ SELECT employee_id
435
+ FROM Employees
436
+ WHERE manager_id NOT IN (
437
+ SELECT employee_id
438
+ FROM Employees
439
+ )
440
+ AND salary < 30000
441
+ ORDER BY employee_id
442
+ ```
443
+
444
+ [ 185. Department Top Three Salaries] ( https://leetcode.com/problems/department-top-three-salaries )
445
+ ``` sql
446
+ WITH RankedSalaries AS
447
+ (SELECT
448
+ e .Id AS employee_id,
449
+ e .name AS employee,
450
+ e .salary ,
451
+ e .departmentId ,
452
+ DENSE_RANK() OVER (PARTITION BY e .departmentId ORDER BY e .salary DESC ) AS salary_rank
453
+ FROM Employee e)
454
+ SELECT d .name AS Department,
455
+ r .employee ,
456
+ r .salary
457
+ FROM Department d
458
+ JOIN RankedSalaries r ON r .departmentId = d .id
459
+ WHERE r .salary_rank <= 3 ;
429
460
```
You can’t perform that action at this time.
0 commit comments