Given a dataset of customer transactions, write a SQL query to find the top 5 customers by total spend.
Use the provided customer and transaction data. Include transaction amounts in the total, treating missing amounts as zero. Return customers with transactions, ordered from highest total spend to lowest, with customer name ascending as the tie-breaker.
customer_name and total_spent.total_spent descending, then customer_name ascending.| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer's full name |
| VARCHAR(255) | Customer email address |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| customer_id | INT | Customer associated with the transaction |
| amount | DECIMAL(12,2) | Transaction amount |
| transaction_date | DATE | Date the transaction occurred |