All tasks

Calculation of Full Assembly Cost (BOM)

Expert

SAP/Manufacturing level task. **Condition:** Calculate the full cost of each final product, including all components and subcomponents taking into account quantity. **Table:** components (component_id, name, parent_id, unit_cost, quantity) **Requirements:** 1. Recursively traverse the component tree 2. Multiply unit_cost by quantity at each level 3. Sum the costs of all components 4. Output for final products (parent_id IS NULL): name, total_cost **Hint:** In the recursion, accumulate

Category
Recursive CTE
Estimated time
~35 min
Databases
PostgreSQLGreenplum
Tags
InterviewRecursive CTEBOMManufacturingAggregationрекурсия

Sign in to solve

Start Solving