PARTITION BY, ROWS vs RANGE, running totals, ranking, sessionization, gap detection. С подсказками по производительности.