Oracle “Partition By” Keyword

前端 未结 6 892
不思量自难忘°
不思量自难忘° 2020-11-29 14:22

Can someone please explain what the partition by keyword does and give a simple example of it in action, as well as why one would want to use it? I have a SQL

6条回答
  •  鱼传尺愫
    2020-11-29 15:00

    It is the SQL extension called analytics. The "over" in the select statement tells oracle that the function is a analytical function, not a group by function. The advantage to using analytics is that you can collect sums, counts, and a lot more with just one pass through of the data instead of looping through the data with sub selects or worse, PL/SQL.

    It does look confusing at first but this will be second nature quickly. No one explains it better then Tom Kyte. So the link above is great.

    Of course, reading the documentation is a must.

提交回复
热议问题