Home improvement sales

Question

You're given the following table showing sales information for a home improvement store. The table below shows units sold for each product (specified by product_id) along with each product’s associated category:
Table: sales_info

category product_id units_sold
Home 123 2000
Tools 124 3500
Home 125 5000
Outdoor 126 1200
Outdoor 127 6000
Tools 128 1000
Home 129 1400

Using this table, write a SQL query to return the following:

category product_id total_units_sold percent_of_category
... ... the total sales of the given product the percent of the total category sales the given product represents...

You can view/query the table in an interactive SQL fiddle here.

Solution

Access restricted

Subscribe to premium account to see the solution.

Get premium now