-- 逻辑拆解:不同类别下,销售金额排名前三且利润率超过20%的商品,难点是group by和窗口函数的关系(窗口函数必须比group by具更粗的颗粒度,而且所用的字段必须是group by里面包含的) SELECT a.product_id, a.product_name, a.category_id, a.sales_amount, a.profit_rate FROM( SELECT t1.product_id, t1.product_name, t1.category_id, SUM(sales_amount) sales_amount, ROUND((SUM(sales_amoun...