Write a SQL query using subqueries to filter a dataset based on an aggregated condition.
Use the provided customers and transactions tables. Return customers whose total transaction amount is greater than the average total transaction amount across customers with valid transactions. Exclude unmatched transactions.
customer_id, customer_name, and total_amount.total_amount descending, then customer_id ascending.| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer name |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| customer_id | INT | Customer associated with the transaction |
| amount | DECIMAL(10,2) | Transaction amount |