Return departmentid and all employee names in it as one comma-separated string (members). Table definitions (from the…
SQLLevel: AdvancedAdvanced and misc
Return department_id and all employee names in it as one comma-separated string (members).
Table definitions (from the source exercise):
CREATE TABLE employees(emp_id INTEGER PRIMARY KEY, name TEXT, department_id INTEGER, manager_id INTEGER, salary INTEGER, hire_date TEXT, job_title TEXT, gender TEXT);
Hints
- Define one output row and the source-table keys.
- Check duplicates, NULLs and the order of filtering and aggregation.
Answer
This answer is part of mentoring
Advanced questions come with a full breakdown and a mock interview with a working quant researcher. The first call is free.
Source and licence: SQL Practice Lab — Ebrahim Sharifi · MIT