Sandeep Gangarapu

MODE SQL Notes

            
LAG and LEAD window functions example
- LAG(colname, 2) will skip 2 rows instead of 1 - WINDOW statement - SELECT start_terminal, duration_seconds, NTILE(4) OVER ntile_window AS quartile, NTILE(5) OVER ntile_window AS quintile, NTILE(100) OVER ntile_window AS percentile FROM tutorial.dc_bikeshare_q1_2012 WINDOW ntile_window AS (PARTITION BY start_terminal ORDER BY duration_seconds