Skip to content
Quantoros

Return the management chain of Jack Cole up to the CEO: name and level (1 = Jack himself), in level order. Table…

SQLLevel: AdvancedAdvanced and misc

Return the management chain of Jack Cole up to the CEO: name and level (1 = Jack himself), in level order.

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

Related questions