Average Power Consumption by Chipset Category

Quick Overview

Write a SQL query that groups chipsets by category and returns the average power consumption of each category, rounded to two decimal places and sorted by category. It tests GROUP BY aggregation, AVG and ROUND on decimal columns, and deterministic output ordering.

Average Power Consumption by Chipset Category

Company: Qualcomm

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: easy

Interview Round: Other

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. ```hint Where to round Compute the exact average for each group first, then round only that final value. ``` ### 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.

Overview: Write a SQL query that groups chipsets by category and returns the average power consumption of each category, rounded to two decimal places and sorted by category. It tests GROUP BY aggregation, AVG and ROUND on decimal columns, and deterministic output ordering.

Qualcomm logo
Qualcomm
Nov 24, 2026
easyData ScientistOtherData Manipulation (SQL/Python)
0
0

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

ColumnTypeMeaning
chipset_idINTUnique identifier of the chipset
categoryVARCHAR(50)Product category of the chipset, never NULL
modelVARCHAR(100)Model name, never NULL
power_consumption_mWDECIMAL(10,2)Power consumption in milliwatts, never NULL

Primary key: chipset_id.

Output Contract

ColumnTypeMeaning
categoryVARCHARA category that appears in Chipsets
avg_power_consumptionDECIMALAverage 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_idcategorymodelpower_consumption_mW
1WearableW-5120.50
2MobileM-1003500.00
3MobileM-2004200.25
4WearableW-498.30
5ModemX-70750.10
6WearableW-3110.00

Expected output:

categoryavg_power_consumption
Mobile3850.13
Modem750.10
Wearable109.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.