Marketplace Seller Analytics Path · Mission 5 of 25Easy

Top 10 active listings by gross revenue

First LEFT JOIN. Practice preserving listings with zero orders via LEFT JOIN, computing SUM with COALESCE-ish defaults (the LEFT JOIN naturally produces NULL → 0 via SUM), and producing the top-N listings the merchandising team uses for promo planning.

Back to Marketplace Seller Analytics

The Brief

Iris PatelMarketplace Operations Leadmarketplace-ops

Promo planning Friday. Pull the top 10 active listings by gross revenue (sum of fact_orders.gross_amount). Restrict to current_status = 'active'. Four columns: listing_id, product_title, orders (count of order rows), gross_revenue (rounded to 2 decimals). Sort gross_revenue descending, listing_id ascending. The merchandising team uses this to pick promo candidates — top revenue listings get the home-page placement.

You'll practice

Multi-table JOINGROUP BYAggregate

Tables & columns available

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

Hints (4)

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

Hint 1

LEFT JOIN fact_orders on listing_id — preserves listings with zero orders (they get gross_revenue = 0 via SUM(NULL) in many SQL dialects, or 0 explicit).

Hint 2

Filter dim_listings WHERE current_status = 'active' in the WHERE.

Hint 3

ROUND(SUM(o.gross_amount), 2) for clean output.

Hint 4

ORDER BY gross_revenue DESC, listing_id ASC, LIMIT 10.