A
A
Alexander Popov2019-08-21 20:59:40
Database design
Alexander Popov, 2019-08-21 20:59:40

What scheme to choose for a database with n-th table nesting?

Hello! There is a need to write a program to view the auto-parts hierarchy. To make it easier to understand, let's take an airplane for example. The aircraft conventionally consists of a body, wings, engine, tail and cockpit. The engine, in turn, consists of a turbine, a combustion chamber, etc. The combustion chamber, in turn, also consists of simpler components. It turns out that each detail can have the n-th level of nesting
Simplified:
5d5d864b60b2e377857373.jpeg
Please share your experience in creating a database schema for similar cases. Perhaps there is a specific pattern?
Thanks in advance)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2019-08-21
@Tideus

Machine:
 ....

Part:
  parent_part = FK(Part)
  machine = FK(Machine)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question