Introduction
The very basics
Infinite looping
Processing trees with recursive CTEs
24. Additional exercise – new table
Processing graphs with recursive ctes
Summary

Instruction

Fine work! 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'll have to learn a new table.

Exercise

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 – the ID of each department,
  • Name – the name of the department,
  • PartOf – the ID of the department one level up.