WITH RECURSIVE employee_hierarchy AS (
SELECT employee_id,
first_name,
last_name,
reports_to,
'Owner' AS path
FROM employee
WHERE reports_to IS NULL
UNION ALL
SELECT
e.employee_id,
e.first_name,
e.last_name,
e.reports_to,
employee_hierarchy.path || '->' || e.last_name
FROM employee e, employee_hierarchy
WHERE e.reports_to = employee_hierarchy.employee_id
)
SELECT *
FROM employee_hierarchy;