- Window Functions: Rolling aggregations, partitioned calculations
- GROUPING SETS: Multi-level aggregations in single queries
- CTEs: Modular query structure
- State Tracking: Growth accounting and cohort analysis
| File | Pattern | How Used | Why Useful |
|---|---|---|---|
time-series-web-traffic-analysis.sql |
Rolling Aggregations | Window functions with ROWS BETWEEN for cumulative sums | Track traffic trends over time with rolling metrics |
user_activity_funnel_analysis.sql |
User Journey Mapping | Self-joins to track page-to-page navigation | Understand user behavior and optimize conversion paths |
event_to_conversion_analysis.sql |
Conversion Funnel | CTEs with self-joins for same-day conversion tracking | Measure which pages drive conversions to payment |
multi_dimensional_aggregation_pattern.sql |
OLAP Reporting | GROUPING SETS for multi-level aggregations | Generate reports at different granularities in one query |
dimensional_rollup_analysis.sql |
Materialized Views | GROUPING SETS with automatic level identification | Create performance-optimized dashboard tables |
| File | Pattern | How Used | Why Useful |
|---|---|---|---|
growth_accounting.sql |
State Change Tracking | CASE statements with FULL OUTER JOINs | Track user lifecycle states (New, Retained, Churned) |
retention_analysis.sql |
Cohort Analysis | Date arithmetic with GROUP BY | Measure user retention over time |
| File | Pattern | How Used | Why Useful |
|---|---|---|---|
players/window_function_analysis.sql |
Rolling Performance | Window functions with 90-game sliding windows | Analyze team/player performance trends over time |
players/grouping_sets_analysis.sql |
Multi-Dimensional Stats | GROUPING SETS for player/team/season aggregations | Efficient sports statistics reporting at multiple levels |
players/change_state_tracking.sql |
Career State Changes | FULL OUTER JOINs with CASE statements | Track player career transitions across seasons |