Write a SQL query to identify the top customer segment by revenue using transaction data, including joins and aggregations as needed at Stone.
Use the provided transaction, customer, and segment data. Return every segment tied for the highest total revenue.
segment_id, segment_name, and total_revenue.total_revenue descending, then segment_name ascending.| Column | Type | Description |
|---|---|---|
| segment_idPK | INT | Unique customer segment identifier |
| segment_name | VARCHAR(100) | Customer segment name |
| Column | Type | Description |
|---|---|---|
| customer_idPK | INT | Unique customer identifier |
| customer_name | VARCHAR(150) | Customer name |
| segment_id | INT | Customer segment identifier |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| customer_id | INT | Customer associated with the transaction |
| amount | DECIMAL(12,2) | Transaction revenue amount |