Transaction Volume by Country
Problem statement
Given credit-card transactions, calculate the total transaction amount for every country.
Return country and total_transaction_amount, ordered by total amount descending and then country ascending.
Table schema
MySQLPostgreSQLPandas
Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.
transactions
| Column | Type | Nullable | Description |
|---|---|---|---|
| transaction_idPK | Integer | No | — |
| country | Text | No | — |
| transaction_date | Date | No | — |
| transaction_amount | Decimal | No | — |
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| country | Text | No | — |
| total_transaction_amount | Decimal | No | — |
Row order: must match exactly. Numeric tolerance: 0.
Constraints
- Every transaction has one country and a non-negative amount.
- All transaction rows count.
- Use exact decimal arithmetic.