Marketplace Seller Analytics Path · Mission 3 of 25Easy

Top 10 listings by units sold

Aggregation with SUM, JOIN to dim for human-readable column. Practice grouping by two columns simultaneously (listing_id + product_title) which is required when you want both id and label in the output without having a non-aggregated column issue.

Back to Marketplace Seller Analytics

The Brief

Iris PatelMarketplace Operations Leadmarketplace-ops

Quarterly product review prep. Give me the top 10 listings by units_sold (SUM of fact_orders.units, all-time). Three columns: listing_id, product_title, units_sold. Sort units_sold descending, listing_id ascending as tiebreaker. The top 10 should look like our hero SKUs — anything in the top 10 you don't recognize is interesting.

You'll practice

INNER JOINGROUP BYORDER BY DESCLIMIT

Tables & columns available

fact_ordersfact7 columns
ColumnTypeKey
order_idINTPK
listing_idINTFK → dim_listings
marketplace_idINTFK → dim_marketplaces
order_tsTEXT
unitsINT
gross_amountREAL
refundedINT
dim_listingsdim7 columns
ColumnTypeKey
listing_idINTPK
marketplace_idINTFK → dim_marketplaces
asin_or_listing_idTEXT
product_titleTEXT
categoryTEXT
list_priceREAL
current_statusTEXT

Hints (4)

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

Hint 1

SUM(o.units) AS units_sold from fact_orders.

Hint 2

JOIN dim_listings on listing_id to pull product_title.

Hint 3

GROUP BY listing_id, product_title — both are needed to keep both in the output.

Hint 4

ORDER BY units_sold DESC, listing_id ASC and LIMIT 10.