hard · ~12 min
Commercial Analytics needs a product-level sales rollup combining line-item transactions with catalog metadata.
line_items
total_revenue
quantity * price
total_units
quantity
order_count
order_id
product_id
product_name
category
Input contract: item_id is the non-null primary key of line_items (multiple line items can share the same order_id and product_id); order_id, product_id, quantity, and price are non-null. product_id is the non-null primary key of products (one row per product); product_name and category are non-null.
item_id
price
products