Scenario SQL Question
Find Product Component Hierarchy (Bill of Materials)
Build mastery in Self Joins Hierarchical with this scenario-based SQL challenge and live execution support.
Problem Statement
Use a recursive CTE to display the complete bill of materials for product_id 1 (Bicycle). Quantities multiply down the tree (a Wheel needs 2, each Wheel has 32 Spokes → 64 Spokes total). Return product_id, product_name, component_id, component_name, quantity, level — ordered by level, component_id.
Relevant Tables
bill_of_materials
SQL Concepts Used in This Scenario
Strengthen your understanding with these targeted learning topics: