By Sherwin Zheng

The window function is a must know in SQL interviews now, though it has just been available on, for example, MySQL 8.0 since its release on 19 April 2018.

A Note

Readers of this article are assumed to know SQL window functions other than basic SQL syntax. If you are not familiar with it and want to learn more, please refer to this [link] which I used for my learning. Please be noted that the syntax may differ on various SQL platforms.

Although not covering all aspects of SQL window function, this article will introduce you to several common applications of it that are tested during the interview using examples from Leetcode.com

The most recent Leetcode question 1596. The Most Frequently Ordered Products for Each Customer inspired me to write about this theme because it linked a bunch of knowledge points together, including the window function and its application from easy to intermediate, correlated subquery and its relationship with the window function, and the execution sequence of SQL statements.

#window-functions #data-science #programming #data-analysis #sql

SQL Window Function — Demonstrated with Real Interview Questions from Leetcode
3.60 GEEK