Pharma Commercial Analytics Path · Mission 1 of 25Easy

Active products by therapeutic class

Get hands-on with dim_product — the product catalog that anchors every pharma commercial query. Practice basic single-table SELECT, GROUP BY with COUNT(*), and a two-level ORDER BY (descending on the metric, ascending on the dimension as a stable tiebreaker).

The Brief

Riley SinghJunior Analystslack-dm

First day on the brand team — Priya asked me to learn the product portfolio before the Cardiozin launch readout next week. From dim_product, give me a count of how many products we carry per therapeutic class, sorted by product count descending so the most crowded class leads. Tiebreaker: alphabetical on therapeutic class so the order is stable when two classes tie at one product. Two columns: therapeutic_class and product_count.

You'll practice

Single-table SELECTWHERE filterORDER BY

Tables & columns available

dim_productdim6 columns
ColumnTypeKey
product_idINTPK
brand_nameTEXT
generic_nameTEXT
therapeutic_classTEXT
is_launch_brandINT
launch_dateTEXT

Hints (3)

Each hint you reveal reduces the XP you can earn. Try the query first.

Hint 1

Single-table aggregate. dim_product is the only table you need; group by the class column and count.

Hint 2

Group by the class column and COUNT(*). Riley's slide template expects the count alias as product_count.

Hint 3

You'll need a two-level sort to keep the order stable when classes tie at one product — descending on the count, ascending on the class name as tiebreaker.