>_
busy_managers.sql
MariaDB 11.4
Not run yet

+ 5 hidden

Input
crew
crew_id  crew_name         team      reports_to
1        Marisol Okafor    camera    null
2        Tobias Lindqvist  camera    1
3        Nell Achebe       camera    1
4        Ravi Menon        lighting  1
5        Saoirse Kenny     lighting  1
6        Dmitri Volkov     sound     1
7        Lupe Ferreira     camera    2
8        Ottilie Brandt    camera    2
9        Kofi Mensah       camera    2
10       Yara Haddad       camera    2
Expected
[{"manager_name": "Marisol Okafor"}]

Tobias, Nell, Ravi, Saoirse and Dmitri report to Marisol: exactly five, which is enough, across three teams. Tobias has four reports of his own, one short, and those four do not count towards Marisol.