bom says how many units of child_part go into ONE unit of parent_part. A top-level product is a part that appears as a parent but never as a child; a base part never appears as a parent. Sub-assemblies can be shared and nested to any depth. For every top-level product return product, base_part and total_qty (units of that base part needed to build one product, summed over all paths). Order by product, base_part.
| Column | Type |
|---|---|
| parent_part | TEXT |
| child_part | TEXT |
| qty_per | REAL |
| parent_part | child_part | qty_per |
|---|---|---|
| BIKE | FRAME | 1 |
| BIKE | WHEEL | 2 |
| WHEEL | SPOKE | 32 |
| WHEEL | RIM | 1 |
| WHEEL | TUBE | 1 |
| FRAME | STEEL_TUBE | 4 |
| FRAME | BOLT | 6 |
| WHEEL | BOLT | 2 |
| product | base_part | total_qty |
|---|---|---|
| BIKE | BOLT | 10 |
| BIKE | RIM | 2 |
| BIKE | SPOKE | 64 |
| BIKE | STEEL_TUBE | 4 |
| BIKE | TUBE | 2 |
Solve it in the live editor on this page — run on sample data, then submit against hidden tests.
‹ Consecutive Failed Job Runs · Average Time Spent In Progress ›
{{ totalCount }} questions in the style asked at Amazon, Microsoft, Google, Meta, Flipkart and more — {{ hardPct }}% Hard. Write SQL in a real database engine in your browser, run it on sample data, then evaluate against hidden tests.
Company tags show where this type of question is commonly reported in interviews. Questions, data and solutions are written by TechTown.
{{ cur.statement }}
No submissions yet. Press Evaluate to submit your query.
{{ solutionSql }}
{{ out.error }}
You have solved your 3 free questions — nice work! Log in (free) to unlock all 150 questions, keep your streak and appear on the leaderboard.