select product_category,age_group,total_sales_amount,round(total_sales_amount/sum(total_sales_amount) over(partition by product_category ),2) as purchase_percentage
from(select category as product_category,age_group,sum((quantity * price)) as total_sales_amount
from products p join sales s on p.product_id = s.product_id join customer_info c on s.sale_id = c.sale_id
group by age_group,category) as t
group by product_category,age_group
order by product_category,purchase_percentage desc