Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
The very basics
Infinite looping
Processing trees with recursive CTE
Processing graphs with recursive CTE


Fine! Let's do one more exercise. This time, you'll have to write the query from scratch. Before you proceed to writing the query, you have to learn new table.


Instead of employees, we're now going to deal with departments from the table department.

Select all data from the table. It contains the following columns:

  • id – ID of each department,
  • name – name of the department,
  • part_of – ID of the department one level up.