Your question is SQL Average Transaction Per Customer. Start with the requirements and the one table on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
xAI's finance analytics team wants a per-customer view of transaction values. Write a PostgreSQL query that calculates the average transaction amount for transactions recorded during the past year. Assume CURRENT_DATE is 2026-08-29 when evaluating the sample output.
customer_id, with the average rounded to two decimal places, ordered by customer ID.AVG function does by default.| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| customer_id | INT | Customer associated with the transaction |
| amount | NUMERIC(10,2) | Transaction amount |
| transaction_date | DATE | Date the transaction occurred |