Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Siva.

Asked: June 30, 2016 - 1:12 pm UTC

Last updated: September 13, 2018 - 1:00 am UTC

Version: 1

Viewed 10K+ times! This question is

You Asked

Hi Tom,
I know the purpose of Partition by is to divide the data into groups and Group By is to retrieve result of some aggregate functions.

What is the main difference between partition by and group by?



and Connor said...

Totally different things.

GROUP BY is about aggregation. Take 'n' rows and reduce the number of rows (by summing, or max, or min etc)..But we are *consolidating* some data.

PARTITION BY is about carving up data into chunks. Take 'n' rows, apply some rule to split the rows into buckets...but will still have 'n' rows.

Hope this helps.

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Partition and Group by examples required

Pradeep Tripathi, September 11, 2018 - 12:06 pm UTC

Partition and Group by examples required
Connor McDonald
September 13, 2018 - 1:00 am UTC

I can suggest something better. A complete, 100% free course talking about all of the components of analytics