Hierarchical and Recursive Queries in SQL Server
Jasmin Ludolf
Content Developer
Different levels of components:
Elements to create hierarchy:
PartID
& SubPartID
Elements to describe characteristics:
Component
: EngineTitle
: V6BiTurboVendor
: BMWProductKey
: EV3891ASFCost
: 3000Quantity
: 1+-----------------+---------------------------+
| Component | Level |
|-----------------|---------------------------|
| SUV | 1 |
|-----------------|---------------------------|
| Body | 2 |
|-----------------|---------------------------|
| Hood | 3 |
+-----------------+---------------------------+
+-----------------+---------------------------+
| Component | Quantity |
|-----------------|---------------------------|
| SUV | 1 |
|-----------------|---------------------------|
| Body | 1 |
|-----------------|---------------------------|
| Wheels | 4 |
+-----------------+---------------------------+
Hierarchical and Recursive Queries in SQL Server