revenue_by_year
Get total revenue for any year by summing completed and shipped orders. If no qualifying orders exist for that year, revenue defaults to zero with a note.
Instructions
Return total revenue for a single year (a 4-digit integer, e.g. 2025). Revenue is SUM(orders.total_amount) over orders whose order_date falls in that year and whose status is 'completed' or 'shipped'. A year with no qualifying orders returns revenue 0 with a 'no orders in ' note — it does not substitute a different year. An invalid year returns an error.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| year | Yes |