Partitioning into Different Frames
Explore how to use the partition by clause in PostgreSQL window functions to create frames that group peer rows sharing specific properties. Understand this by examining race results to compare driver positions within constructors, enhancing your analytical queries with partitioned data frames.
We'll cover the following...
We'll cover the following...
Other frames can be defined when using the parition by clause. It allows us to define those rows defining that share a common property with the current row as peer rows, and the property can be defined as a partition.
Pick a race
In the Formula 1 database, we have a results table with results from all the known races. Let’s pick a race:
It gives the following output:
-[ RECORD 1 ]-----------------------------------------------------
raceid | 890
year | 2013
round | 10
circuitid | 11
name | Hungarian Grand Prix
date | 2013-07-28
time | 12:00:00
url | http://en.wikipedia.org/wiki/2013_Hungarian_Grand_Prix