mysql
在’2023-10-27 23:59:59’上增加5秒:
SELECT DATE_ADD('2023-10-27 23:59:59', INTERVAL 5 second);
clickhouse
SELECT date_add(SECOND, 3, toDate('2018-01-01 00:00:00'));
clickhouse时间按秒、分、时、日、月、年作差
按秒:
SELECT dateDiff('second', toDateTime('2022-01-01 20:00:00'), toDateTime('2022-01-02 23:00:00'));
结果 = toDateTime(‘2022-01-02 23:00:00’) - toDateTime(‘2022-01-01 20:00:00’)
, toDateTime('2022-01-02 23:00:00'));