"Write a SQL query for the request below. Schema: orders(id, customer_id, total_cents, status, created_at), customers(id, country, created_at) Request: monthly revenue from completed orders for the last 12 months, split by customer country, including months with zero revenue Dialect: PostgreSQL Rules: 1. Before the query, restate the request in one sentence including grain (one row per what?) and edge decisions (ties, nulls, timezone, inclusive or exclusive date bounds). If the request is ambiguous, state the interpretation you chose. 2. Write the query with CTEs named after business concepts, not t1/t2. 3. Comment any line where a subtle choice hides (join type, null handling, dedup). 4. Then list what would silently break it: schema assumptions you made that the schema text did not confirm. 5. End with a 3-row mock of the expected output shape. Never invent columns; if a needed column is missing from the schema, say which and stop."
No captured outputs yet
This prompt is queued for the next generation run. Check back shortly.