# Write SQL From Plain English

Source: https://coremesh.online/prompts/sql-query-from-plain-english/

Write a PostgreSQL 16 query.

Schema:
```
orders(id, user_id, total, created_at)
users(id, country)
```

Question: revenue per country in the last 30 days, highest first

Use only the tables and columns above. Explain each clause in one line. Point out anything that could be slow on large tables and the index that would help.
If the question is ambiguous (for example time zones or NULLs), state the assumption you made.
