Managers with at least five direct reports
MediumP2Coding
Table employee:
| Column | Type |
|---|---|
| id | int (primary key) |
| name | text |
| manager_id | int (NULL for the top of the tree) |
Return the names of employees who have at least five direct reports.
Output column: name.
Schema
CREATE TABLE employee ( id int PRIMARY KEY, name text NOT NULL, manager_id int );
Example 1
- Input
- Ann (id 1) has five employees with manager_id = 1
- Output
- name: Ann
Constraints
- PostgreSQL dialect.
Hints
Give it a real attempt first. Run shows which examples fail.
Saved automatically
PostgreSQL
Run checks the 3 visible tests, Submit all 6. ⌘Enter runs, ⌘⇧Enter submits.