I am currently working on the SQL fundamentals skill path and have noticed a mistake in one of the exercises.
In the common table expression module on the 7th screen.
The table below is the desired output of the course section.
I used the code below to get the output which gave me the desired output.
Nevertheless, I got an error that the query does not match the expected results.
WITH RECURSIVE managers_chain(employee_id, path) AS ( SELECT employee_id, last_name || ' ' || first_name AS path FROM employee WHERE reports_to IS NULL UNION ALL SELECT e.employee_id ,m.path ||' '||'<--' ||last_name||' '|| first_name FROM employee e JOIN managers_chain m ON e.reports_to = m.employee_id -- TODO: Write the recursive member here ) SELECT path FROM managers_chain;
So, I looked at the answer. The answer was basically the example syntax for recursive functions which does let you pass the assignment once copy and paste it on the screen. However, it does not yield the desired results according to the instructions.