#开窗函数练习
SUM(expr) over()
SELECT
ROW_NUMBER() OVER (ORDER BY milk_tea.sale_price DESC) AS [RANK],*
FROM milk_tea;
select prod_name,net_w,count(*)over(partition by net_w) from milk_tea ;
select prod_name,net_w,count(*)over(partition by net_w) as t from milk_tea ;
select prod_name,net_w,count(*)over(partition by net_w) as t ,count(*) over(partition by prod_name)as h from milk_tea ;
select supplier_id,prod_name,brand,class from prod_info;
select supplier_id,prod_name,brand,class ,count(*)over(partition by class),count(*)over(partition by supplier_id)
from prod_info;
select supplier_id,prod_name,brand,class,cost,sale_price,sum(prod_id) over(order by prod_id rows between unbounded preceding and current row)as t
from prod_info;
select supplier_id,prod_name,brand,class,cost,sale_price,sum(sale_price) over(order by sale_price rows between unbounded preceding and current