Chapter 7 · CTEs
08. Order Fulfillment Pipeline Report
Hard40 XPE-Commerce
Build a pipeline report showing each order's journey. Use CTEs to gather: (1) order info with customer name, (2) payment status, (3) shipping status. Combine them to show order id, order_date, customer name, order status, payment status (or 'unpaid'), shipping status (or 'not shipped'), and delivery_date. Sort by order_date, newest first.
Tables
- PKidINT
- first_nameTEXT
- last_nameTEXT
- emailTEXT
- phoneTEXT
- cityTEXT
- stateTEXT
- countryTEXT
- created_atTIMESTAMP
- PKidINT
- FKcustomer_id→ customers.idINT
- order_dateTEXT
- statusTEXT
- total_amountREAL
- PKidINT
- FKorder_id→ orders.idINT
- payment_dateTEXT
- amountREAL
- methodTEXT
- statusTEXT
- PKidINT
- FKorder_id→ orders.idINT
- shipping_dateTEXT
- delivery_dateTEXT
- carrierTEXT
- tracking_numberTEXT
- statusTEXT
Need help?
Ask Sol
AI tutor — looks at your current query and nudges you, without spoiling the answer.
Solution
Try the hints first — solving it yourself is what makes it stick.