Product share in category < 7%: paid, Feb–Apr 2025
Instructions
A product's revenue is the sum of quantity * order_items.price over the items of orders with the status 'paid' created on or after February 1, 2025 and strictly before May 1, 2025; products without sales in this period are not considered. A category's revenue is the sum of the revenues of its products. Find the products whose share of revenue in the revenue of their category is strictly less than 7% (compare the unrounded share). Output category (the category name), product (the product name), revenue and share_pct, the share as a percentage, rounded to 2 decimal places. Row order does not matter.
Hints
Each next one is more detailed and costs more
Query
Result
Click Run to see the query result, or Check to submit your solution.
Dataset schema
Table relationships
- N:1Many-to-one
order_items.→order_id orders.id - N:1Many-to-one
order_items.→product_id products.id - N:1Many-to-one
orders.→customer_id customers.id - N:1Many-to-one
products.→category_id categories.id
Table data
Select a table in the diagram or list to view its rows.