本笔记为阿里云天池龙珠计划SQL训练营的学习内容,链接为:https://tianchi.aliyun.com/specials/promotion/aicampsql;
-- 习题1答案:结果为按product_id升序后得到的截至当前行的最高价格
select product_id,
product_name,
sale_price,
max(sale_price) over (order by product_id) as current_max_price
from product;
-- 习题2答案
select regist_date, product_id,product_name,sale_price,
sum(sale_price) over(order by regist_date ) as sum_price
from product;
-- 习题3答案:没有partitionby就不会分组,而是对全表进行排序;