Can you describe a scenario where you would choose a specific data modeling technique over another?
Using the supplied schema, write a query that produces an analytics-ready monthly revenue result. The query should include completed orders only and handle customers without a populated segment.
Output
- One row per customer segment and calendar month
- Columns:
segment, revenue_month, completed_orders, revenue
- Include only segments with completed revenue, order by
segment ascending and revenue_month ascending
Output details
- Represent missing segments as
Unclassified.
- Represent
revenue_month as the first day of each calendar month.
- Calculate
completed_orders as distinct order counts.
- Calculate
revenue as the sum of quantity * unit_price.