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

## Instruction

Alright. It's time for an example with a tree.

## Exercise

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

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

The root folder has NULL parent_id. For that folder, the path should be: /.