Group by Time in SQL
Say you have a timestamp column, and you want to find out how many records are there for a particular day, or hour, or week. You can do this using the date_trunc function.
SELECT DATE_TRUNC('DAY', created_at), COUNT(*)
FROM my_table
GROUP BY DATE_TRUNC('DAY', created_at);
date_trunc is also available in Snowflake.