Shopify
Foundations Track · Medium · 25 min
6. What is the percentage of sales for Retail vs Shopify for each month
WITH monthly_sales AS ( SELECT month_number, CASE WHEN platform = 'Retail' THEN sales ELSE 0 END AS retail_sales, CASE WHEN platform = 'Shopify' THEN sales E...
Company labels are directional practice context, not official interview guidance.
Objective
Practice aggregation through a Shopify-tagged business scenario.
Approach
Use this track to lock in clean query structure, basic filtering logic, and confidence with grouped output.
Company context
Company labels are directional practice context, not official interview guidance.
WITH monthly_sales AS ( SELECT month_number, CASE WHEN platform = 'Retail' THEN sales ELSE 0 END AS retail_sales, CASE WHEN platform = 'Shopify' THEN sales ELSE 0 END AS shopify_sales FROM weekly_sales_cleaned ) SELECT month_number, ROUND(SUM(retail_sales) * 100.0 / (SUM(retail_sales) + SUM(shopify_sales)), 2) AS retail_pct, ROUND(SUM(shopify_sales) * 100.0 / (SUM(retail_sales) + SUM(shopify_sales)), 2) AS shopify_pct FROM monthly_sales GROUP BY 1 ORDER BY 1 Result set: month_number retail_pct shopify_pct ------ 3 97.54 2.46 4 97.59 2.41 5 97.30 2.70 6 97.27 2.73 7 97.29 2.71 8 97.08 2.92 9 97.38 2.62 ---
This is a Pro question
Upgrade to Pro to unlock this prompt, the SQL workspace, and all 254 problems.
Upgrade to Pro — unlock all 254 problemsSQL workspace
Run queries against the protected question data, then submit once the result shape looks right.
Sign in to run SQL
Create a free account or sign in before running queries against protected question data.