Loading problem...
You are maintaining a customer growth table called Customer.
Each row contains:
Return the names of customers who are eligible under the following policy:
Return exactly one column:
Row order is not semantically important unless your local checker enforces deterministic ordering.
This problem should be solvable in both:
Customer:
| id | name | referee_id |
|----|-------|------------|
| 1 | Will | null |
| 2 | Jane | null |
| 3 | Alex | 2 |
| 4 | Bill | null |
| 5 | Zack | 1 |
| 6 | Mark | 2 |[
{"name":"Will"},
{"name":"Jane"},
{"name":"Bill"},
{"name":"Zack"}
]Rows referred by customer 2 are excluded. NULL and non-2 referee rows remain.
Customer:
| id | name | referee_id |
|----|--------|------------|
| 10 | Priya | 7 |
| 11 | Omar | 2 |
| 12 | Carla | null |
| 13 | Mei | 999 |[
{"name":"Priya"},
{"name":"Carla"},
{"name":"Mei"}
]Referrers other than 2 are allowed, even if that referrer id does not appear in the table.
Customer:
| id | name | referee_id |
|----|------|------------|
| 20 | Sam | 2 |
| 21 | Sam | null |
| 22 | Sam | 5 |[
{"name":"Sam"},
{"name":"Sam"}
]Eligibility is evaluated per row. Duplicate names can appear multiple times if multiple rows satisfy the rule.
Constraints