參考: https://www.cnblogs.com/qianxunman/p/12105961.html
如果需要在類別(type)內按照價格(price) 升序排列(就是在類別內做排序),該怎麼做呢?即在一個type範圍內子排序
當然也很簡單,只需要在窗口(over())中聲明分隔方式 Partition .
分類排序序號,row_number() 實現>
select type,name,price,row_number() over(PARTITION by type order by price asc) as idx from products ;