P53SQLBeginnerCalculate6 min

Calculate Each Store's Share of Regional Revenue

Compute each store's revenue share inside its region.

#calculate#window-functions#revenue

Scenario

A store_revenue table already has one row per store and region. North stores have revenue 40,000 and 60,000.

Problem statement

Calculate each North store's regional share without joining orders again.

Your Task

  1. Calculate the two shares.
  2. Write a window-function expression.
  3. Explain why the input grain matters.

Related Concepts

Window functionsRevenue shareAggregation grain

Ready to count this problem?

Mark it complete when you have reasoned through the solution in your own words.