Search results
Lessons, SQL functions, SQL Server error numbers, exercises, interview questions, tools, comparisons and blog posts.
21 results for “window functions” in Exercises.
Exercises 9
- Days between each customer order Hard · Window Functions Difference each row from the previous with LAG.
- Each customer first order Medium · Window Functions Pick one row per group with ROW_NUMBER.
- Each product as a percent of its category Hard · Window Functions Divide a row by a partitioned SUM OVER.
- Highest paid employee per department Hard · Window Functions One row per group with a partitioned ranking.
- Month over month growth Hard · Window Functions Compare each period to the previous with LAG.
- Rank employees by salary Medium · Window Functions Assign ranks with a window function.
- Running total of sales Hard · Window Functions Accumulate with SUM OVER and a window frame.
- Three day moving average Hard · Window Functions Average over a sliding window frame.
- Top 3 products per category Hard · Window Functions Rank within groups and filter to the top N.