Task: Get All Child Records Given a Parent ID in a Self-Referencing Table
Task: Get All Child Records Given a Parent ID in a Self-Referencing Table: a task in Terminal-Lego-15k (Harbor dataset). You have a self-referencing hierarchical table where each record can have a parent record in the same table. Your task is to write a SQL query using a recursive Common Table…
The task
You have a self-referencing hierarchical table where each record can have a parent record in the same table. Your task is to write a SQL query using a **recursive Common Table Expression (CTE)** that, given a parent ID, returns the parent record and all of its descendant (child, grandchild, etc.) records.
Part of PrimeIntellect/Terminal-Lego-15k.