Your database design could be a lot easier. You only need two tables.
Suppose you create a car. A car has an engine, an engine has a dynamo a dynamo has bolts and screws so does the engine, so does the car.
You need one table to store the Parts
. such as bolts, screws, engine, wheels and so on.
you need one table to build your car: Product
In the Parts table you have the following fields: ID, description, ...
In the Products table you have the following fields: ParentID, ChildID
Now you can create your queries.