shop_analytics
Run sales analytics without writing SQL: retrieve top customers by spend, customers with most orders, top products, top categories, and revenue by year. Specify the operation, optional year, and limit.
Instructions
Shop aggregations without hand-written SQL.
Operations: top_customers_by_spend (name, email, total_amount; default limit 5), customer_most_orders (name, email, order_count), top_products (product_name, units_sold, revenue; default limit 5), top_categories (category, revenue; default limit 3), revenue_by_year (requires year). Spend/units/revenue use quantity * unit_price and exclude cancelled orders. Year is taken from order_date.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| year | No | ||
| limit | No | ||
| operation | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||