ClickHouse/tests/queries/0_stateless/01561_Date_and_DateTime64_comparision.sql
2020-12-08 17:17:02 +03:00

44 lines
814 B
SQL

SELECT
n,
toTypeName(dt64) AS dt64_typename,
'<',
dt64 < d,
toDate(dt64) < d,
dt64 < toDateTime64(d, 1, 'UTC'),
'<=',
dt64 <= d,
toDate(dt64) <= d,
dt64 <= toDateTime64(d, 1, 'UTC'),
'=',
dt64 = d,
toDate(dt64) = d,
dt64 = toDateTime64(d, 1, 'UTC'),
'>=',
dt64 >= d,
toDate(dt64) >= d,
dt64 >= toDateTime64(d, 1, 'UTC'),
'>',
dt64 > d,
toDate(dt64) > d,
dt64 > toDateTime64(d, 1, 'UTC'),
'!=',
dt64 != d,
toDate(dt64) != d,
dt64 != toDateTime64(d, 1, 'UTC')
FROM
(
SELECT
number - 1 as n,
toDateTime64(toStartOfInterval(now(), toIntervalSecond(1), 'UTC'), 1, 'UTC') AS dt64,
toDate(now(), 'UTC') - n as d
FROM system.numbers
LIMIT 3
)
FORMAT TabSeparated