Home / Companies / Tinybird / Blog / Post Details
Content Deep Dive

ClickHouse ® tips #5: Adding and subtracting intervals

Blog post from Tinybird

Post Details
Company
Date Published
Author
Alberto Romeu
Word Count
155
Language
English
Hacker News Points
-
Summary

ClickHouse® supports adding and subtracting time and date intervals using a syntax similar to that of other databases like Postgres, which includes the INTERVAL keyword. This feature allows users to manipulate dates with various intervals such as seconds, minutes, hours, days, weeks, months, quarters, and years without the need for parentheses, providing flexibility in constructing queries. Users can combine multiple intervals in a single query, and while the smallest supported interval is a second, there are workarounds to achieve finer precision. Furthermore, the functions now(), interval, and other interval types are case-insensitive, allowing for versatile use in both uppercase and lowercase formats.