The Chipsets table lists chipset models with their product category and power consumption in milliwatts. For each category, return the average power_consumption_mW as avg_power_consumption, rounded to 2 decimal places. Order the result by category ascending.
Input Table(s)
Chipsets
| Column | Type | Meaning |
|---|
| chipset_id | INT | Unique identifier of the chipset |
| category | VARCHAR(50) | Product category of the chipset, never NULL |
| model | VARCHAR(100) | Model name, never NULL |
| power_consumption_mW | DECIMAL(10,2) | Power consumption in milliwatts, never NULL |
Primary key: chipset_id.
Output Contract
| Column | Type | Meaning |
|---|
| category | VARCHAR | A category that appears in Chipsets |
| avg_power_consumption | DECIMAL | Average power_consumption_mW over all chipsets in that category, rounded to 2 decimal places |
-
One row per distinct
category
in
Chipsets
.
-
Rows are ordered by
category
ascending. Each category appears exactly once, so this order is unique.
Example
Chipsets
| chipset_id | category | model | power_consumption_mW |
|---|
| 1 | Wearable | W-5 | 120.50 |
| 2 | Mobile | M-100 | 3500.00 |
| 3 | Mobile | M-200 | 4200.25 |
| 4 | Wearable | W-4 | 98.30 |
| 5 | Modem | X-70 | 750.10 |
| 6 | Wearable | W-3 | 110.00 |
Expected output:
| category | avg_power_consumption |
|---|
| Mobile | 3850.13 |
| Modem | 750.10 |
| Wearable | 109.60 |
Mobile has two chipsets: (3500.00 + 4200.25) / 2 = 3850.125, which rounds to 3850.13. Wearable averages three chipsets: 328.80 / 3 = 109.60. Modem has a single chipset, so its average is its own value. "Mobile" sorts before "Modem" because "b" comes before "d".
Constraints and Clarifications
-
Chipsets
has at most 10,000 rows.
-
power_consumption_mW
is non-negative and never NULL.
-
category
is a non-empty string and never NULL.
-
Every row counts once in its category's average, even when two chipsets share the same
model
name or the same power value.
-
Only categories that have at least one row appear in the output.