Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
Infinite looping
Processing trees with recursive CTEs
Processing graphs with recursive ctes
Summary
36. Exercise 2

Instruction

All right! It's time for an example with a tree.

Exercise

Take a look at the Folder table. Each folder has an ID, a name, and an ID of a parent folder, which is the folder from which we can access the given folder.

Show four columns: Id, Name, ParentId, and Path. The last column should contain the path to the folder, starting with N'/' and followed by all folder names separated by N'/'. At the end of the path, there should be the name of the given folder and a slash (N'/').
An example for folder B, which is in the root folder A, would be: /A/B/.