Marketplace Seller Analytics Path · Mission 8 of 25Medium

Listing CTR from views

Two LEFT JOIN aggregation with ratio computation. Practice computing CTR (orders / views × 100) with NULLIF guard, restricting to active listings, and producing the top-N output the listing-merchandising team uses for promotional sponsorship.

Back to Marketplace Seller Analytics

The Brief

Asher ChenListing Managermarketplace-ops

Listing optimization sprint kickoff. Top 10 active listings by view count, with CTR (orders / views × 100, rounded to 2 decimals). Five columns: listing_id, product_title, views (count of fact_listing_views), orders (count of fact_orders), ctr_pct. Sort views descending, listing_id ascending. The bottom-CTR listings in the top-views set are the prime optimization targets — high traffic, low conversion.

You'll practice

JOINRatioNULLIF guard

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_listing_viewsfact4 columns
ColumnTypeKey
view_idINTPK
listing_idINTFK → dim_listings
viewed_atTEXT
sourceTEXT
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

Two LEFT JOINs: dim_listings → fact_listing_views (for view count) AND dim_listings → fact_orders (for order count).

Hint 2

Filter dim_listings WHERE current_status = 'active'.

Hint 3

GROUP BY listing_id, product_title.

Hint 4

ctr_pct = ROUND(100.0 * COUNT(DISTINCT order_id) / NULLIF(COUNT(view_id), 0), 2). NULLIF prevents div-by-zero on listings with zero views.