Nvidia's Partner Sales team tracks GPU orders placed by its reseller partners. They want to identify which partners had an unusually strong `Q2 2023` (`2023-04-01` to `2023-06-30`), defined as partners whose total order amount in `Q2 2023` was strictly greater than their own historical average quarterly order total (averaged across every quarter in which they placed at least one order). Write a query to find these partners. Output the `partner_name`, their `Q2 2023` total order amount, and their overall average quarterly order total (rounded to `2` decimal places). Only include partners who actually placed orders in `Q2 2023`, and only include partners whose `Q2 2023` total exceeds their average (a tie does not count). Sort the results by `partner_name` in descending alphabetical order. ### Table Schema | Table | Column | Type | |---|---|---| | `gpu_orders` | `order_id` | integer | | `gpu_orders` | `partner_id` | integer | | `gpu_orders` | `partner_name` | string | | `gpu_orders` | `gpu_model` | string | | `gpu_orders` | `order_amount` | decimal | | `gpu_orders` | `order_date` | date | ### Example Input: `gpu_orders` | order_id | partner_id | partner_name | gpu_model | order_amount | order_date | |---|---|---|---|---|---| | `1` | `1` | Apex Compute | `H100` | `6000.00` | `2023-02-10` | | `2` | `1` | Apex Compute | `H100` | `4000.00` | `2023-02-20` | | `3` | `1` | Apex Compute | `A100` | `15000.00` | `2023-05-05` | | `4` | `1` | Apex Compute | `RTX 4090` | `8000.00` | `2023-08-12` | | `5` | `2` | Vertex Silicon | `RTX 4090` | `5000.00` | `2023-05-15` | ### Example Output Explanation Apex Compute has three quarters of activity: `Q1 2023` totals `10000.00` (`6000.00` + `4000.00`), `Q2 2023` totals `15000.00`, and `Q3 2023` totals `8000.00`. Their average quarterly total is `11000.00` ((`10000.00` + `15000.00` + `8000.00`) / `3`). Since `15000.00` > `11000.00`, Apex Compute is included in the output. Vertex Silicon only has one quarter of history (`Q2 2023`, totaling `5000.00`), so their average quarterly total equals `5000.00` exactly — since their `Q2 2023` total is not strictly greater than their average, they are excluded.
DROP TABLE IF EXISTS gpu_orders; CREATE TABLE gpu_orders (order_id INT, partner_id INT, partner_name VARCHAR(255), gpu_model VARCHAR(100), order_amount DECIMAL(10,2), order_date DATE); INSERT INTO gpu_orders VALUES (1, 1, 'Apex Compute', 'H100', 6000.00, '2023-02-10'), (2, 1, 'Apex Compute', 'H100', 4000.00, '2023-02-20'), (3, 1, 'Apex Compute', 'A100', 15000.00, '2023-05-05'), (4, 1, 'Apex Compute', 'RTX 4090', 8000.00, '2023-08-12'), (5, 2, 'Vertex Silicon', 'RTX 4090', 5000.00, '2023-05-15');