How to generate datetime (every minute) using generate_integer()

16 views
Skip to first unread message

Des

unread,
May 5, 2021, 5:30:08 AMMay 5
to ClickHouse
Anyone have any sample SQL they can share? I don't see a function but I see generate_integer() - any help much appreciated... thanks

Vaidas Lauzeckas

unread,
May 5, 2021, 2:51:58 PMMay 5
to ClickHouse
hi Des,
I am not sure i do understand your question, also I am not very technical person, but maybe you are looking for this:

select toStartOfMinute(now())+ number  as seq_date
FROM numbers(999999) num 


Would give you something like this:
seq_date
2021-05-17 08:35:23
2021-05-17 08:35:24
2021-05-17 08:35:25
2021-05-17 08:35:26
2021-05-17 08:35:27
2021-05-17 08:35:28
2021-05-17 08:35:29

V.

Denis Zhuravlev

unread,
May 5, 2021, 8:23:19 PMMay 5
to ClickHouse
select toDateTime('2020-01-01 00:00:00') x, arrayMap(i -> x + interval i second, range(10));

select arrayJoin(arrayMap(i -> toDateTime('2020-01-01 00:00:00') + interval i minute, range(10)));


Reply all
Reply to author
Forward
0 new messages