SQL · Instacart · Medium
Given a table orders with columns order_id, user_id, order_ts (UTC timestamp), geo, status ('completed', 'cancelled', or 'refunded'), subtotal_usd, tax_usd, delivery_fee_usd, and discount_usd, write SQL to answer the following three questions. For all revenue calculations, use only rows where status = 'completed'. For a qualifying row, its revenue is subtotal_usd + tax_usd + delivery_fee_usd - discount_usd. Weeks follow the ISO convention: a week begins on Monday and ends on…
Checking your access…