← All Exercises

Date Truncation for Grouping

basicsql~15min

Background

Date truncation is essential for time series analysis and reporting at different granularities.

Problem

Group event data by hour, day, and month using date truncation functions.

Input

Timestamp column

Output

Aggregated by time period

Sample tests

Sample 1

Input: events with timestamps
Expected: grouped by hour

Your solution

Learning objective

Learn time series aggregation and date functions