>_
earning_more_than_manager.sql
DuckDB 1.5
Not run yet

+ 5 hidden

Input
staff
staff_id  full_name     salary  manager_id
1         Rosa Delgado  9200    null
2         Kwame Asante  7400    1
3         Ilse Brandt   9800    1
4         Tomas Varga   7900    2
5         Priya Raman   6100    3
Expected
[{"employee": "Ilse Brandt"}, {"employee": "Tomas Varga"}]

Ilse earns 9,800 and her manager Rosa 9,200. Tomas earns 7,900 and his manager Kwame 7,400; that Kwame earns less than Rosa does not matter. Rosa has no manager and Priya earns less than Ilse.