จะประกอบรถยนต์อย่างไร?

Hierarchical and Recursive Queries in SQL Server

Jasmin Ludolf

Content Developer

ถอดชิ้นส่วนรถยนต์

ภาพรถยนต์ที่ถอดชิ้นส่วนออก

Hierarchical and Recursive Queries in SQL Server

รายการชิ้นส่วนของรถยนต์

ระดับของชิ้นส่วน:

  • ระดับ 1: SUV, Cabrio
  • ระดับ 2: Body, Engine, Interior Decoration, Wheel
  • ระดับ 3: Door, Hood, Engine Body, Cylinder, Seats

ลำดับชั้นของชิ้นส่วนรถยนต์

Hierarchical and Recursive Queries in SQL Server

สร้างโมเดลข้อมูล

องค์ประกอบสำหรับสร้าง ลำดับชั้น:

  • PartID & SubPartID

องค์ประกอบสำหรับอธิบาย คุณลักษณะ:

  • Component: Engine
  • Title: V6BiTurbo
  • Vendor: BMW
  • ProductKey: EV3891ASF
  • Cost: 3000
  • Quantity: 1

โมเดลข้อมูลของ BillOfMaterial

Hierarchical and Recursive Queries in SQL Server

ใช้งานโมเดลข้อมูลแบบลำดับชั้น

  • ชิ้นส่วนแต่ละระดับที่ประกอบเป็นรถยนต์มีอะไรบ้าง?
+-----------------+---------------------------+
| Component       | Level                     |
|-----------------|---------------------------|
| SUV             | 1                         |
|-----------------|---------------------------|
| Body            | 2                         |
|-----------------|---------------------------|
| Hood            | 3                         |
+-----------------+---------------------------+
Hierarchical and Recursive Queries in SQL Server

ใช้งานโมเดลข้อมูลแบบลำดับชั้น

  • ปริมาณรวมของชิ้นส่วนแต่ละประเภทที่ต้องใช้ในการประกอบรถยนต์ในแต่ละระดับคือเท่าใด?
+-----------------+---------------------------+
| Component       | Quantity                  |
|-----------------|---------------------------|
| SUV             | 1                         |
|-----------------|---------------------------|
| Body            | 1                         |
|-----------------|---------------------------|
| Wheels          | 4                         |
+-----------------+---------------------------+
Hierarchical and Recursive Queries in SQL Server

มาประกอบรถยนต์กันเถอะ!

Hierarchical and Recursive Queries in SQL Server

Preparing Video For Download...