参考: 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 ;