Write a SQL query to analyze weekly order accuracy and missing-item rates by fulfillment center using orders, order_items, and complaints tables.
Use all available order dates. Treat an order as accurate when it has no complaint. Treat a missing-item rate as missing units divided by ordered units. Label orders without a fulfillment center as Unknown.
Output
- One row per calendar week and fulfillment center
- Columns:
week_start, fulfillment_center, total_orders, accurate_orders, accuracy_rate_pct, total_units, missing_units, and missing_item_rate_pct
- Include centers with no complaints and avoid counting an order or item more than once
- Sort by
week_start, then fulfillment_center