The PARTITION BY clause of a Window Function — with an example in MySQL.

In this blog post, I will look at a couple of interesting result sets using the PARTITION BY clause as part of the OVER() clause of a Window Function with an example using MySQL.

Note: All data, names or naming found within the database presented in this post, are strictly used for practice, learning, instruction, and testing purposes. It by no means depicts actual data belonging to or being used by any party or organization.

OS and DB used:

  • Xubuntu Linux 16.04.5 LTS (Xenial Xerus)
  • MySQL 8.0.15

Self-Promotion:

If you enjoy the content written here, by all means, share this blog and your favorite post(s) with others who may benefit from or like it as well. Since coffee is my favorite drink, you can even buy me one if you would like!

We can apply aggregate functions (E.g., SUM(), AVG(), etc …) in conjunction with the OVER() clause of a window function, producing some interesting query results.

Continue reading the full post here…

Josh Otwell has a passion to study and grow as a SQL Developer and blogger. Other favorite activities find him with his nose buried in a good book, article, or the Linux command line. Among those, he shares a love of tabletop RPG games, reading fantasy novels, and spending time with his wife and two daughters.

Have I mentioned how much I love a cup of coffee?!?!