Dates and time: SQL patterns and examples

Grouping by period, comparing with earlier periods, filling gaps and measuring durations. Most date bugs come from time zones, partial periods and months with no data.