
本文共 2515 字,大约阅读时间需要 8 分钟。
���������������Oracle���������������������������������������������������������������������������������������������������������������������������������������������������partition by������������������������������������������������������������������������������������������������������������������������������������������������������
���������������������������������������(over())���������������������������������������() over()������������������������������������������������������(partition by)���������������(order by)���������������(rows)���������������������over(partition by xxx order by yyy rows between zzz)���
������������������������������������"������������"(rows)���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
������������(order by)������������������������������������SQL������������������������������������������������������������������������������������������������������������������������������SQL������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
������������������������������������������
- preceding������������������������������������������������1 preceding������������������������unbounded preceding���������������������������������
- following���������������������������������������������������1 following������������������������unbounded following������������������������������ ���������������������������������������"rows between unbounded preceding and unbounded following"������������������������"rows between unbounded preceding and current row"���������������������������������������"rows between current row and unbounded following"������������������������������������������"rows between 1 preceding and current row"������������������������������������������������������
������������������������������
select t.id, t.name, t.city, t.sales, -- ������������������������������������������������������������������������������������������������������ min(t.sales) over(partition by t.city order by t.sales rows between 3 preceding and current row) as col1from dataset t
���������������������������������������������������������������������������������������������������������������������������������������
发表评论
最新留言
关于作者
