#192

Products Never Purchased in Washington

MEDIUMAnti-Join & Set OperationsPOSTGRESQL

Problem Description

A retail analytics pipeline identifies catalog gaps — products that have never sold in a target market — to inform assortment and distribution decisions. You are working with a retail chain's data warehouse that tracks sales across stores in multiple states. Your task is to calculate the fraction of products in the catalog that have **never been purchased** in **Washington (WA)** state stores. **Tables available:** - `product_dim` — the full product catalog - `store_dim` — store metadata including the `state` each store operates in - `sales_fact` — transaction records linking products to stores **Return** a single column `fraction` representing: ``` fraction = products_never_sold_in_WA / total_products_in_catalog ``` Round the result to **2 decimal places**.

Topics

aggregationpercentage calculationset operationsanti join

Asked at Companies

netflix

Solve This Problem

Sign up to access the interactive code editor, run test cases, view the editorial, and get AI-powered feedback on your solution.

Start Solving →