SQL Server における階層型クエリと再帰クエリ
Jasmin Ludolf
Content Developer

部品の階層:

階層を作る要素:
PartID と SubPartID属性を表す要素:
Component: EngineTitle: V6BiTurboVendor: BMWProductKey: EV3891ASFCost: 3000Quantity: 1
+-----------------+---------------------------+
| Component | Level |
|-----------------|---------------------------|
| SUV | 1 |
|-----------------|---------------------------|
| Body | 2 |
|-----------------|---------------------------|
| Hood | 3 |
+-----------------+---------------------------+
+-----------------+---------------------------+
| Component | Quantity |
|-----------------|---------------------------|
| SUV | 1 |
|-----------------|---------------------------|
| Body | 1 |
|-----------------|---------------------------|
| Wheels | 4 |
+-----------------+---------------------------+
SQL Server における階層型クエリと再帰クエリ