课程: SQL Hands-On Practice: Solve Business Problems

免费学习该课程!

今天就开通帐号,24,700 门业界名师课程任您挑!

Introduction to window functions

Introduction to window functions

- [Instructor] Now that we've seen a real life application of window functions, let's dive deeper in. What do window functions do exactly? Window functions perform calculations across a specified set of rows or a window. Basically, the data is partitioned into pre-specified segments and the calculation is performed for each segment. They work similarly to regular aggregate functions, but instead of performing the aggregate across all rows, it's calculated multiple times, once for each partition of rows. This is super powerful because typically in SQL, calculations are performed on the row level or in the scope of all rows, but with window functions, SQL is able to access a bunch of related rows behind the scenes and perform a calculation for them. It does this multiple times until it completes the calculation for all of the segments. Imagine you have a pile of candies and we want to count the number of candies in…

内容