ClickHouse/tests/queries/0_stateless/01710_projection_with_nullable_keys.sql
2023-09-21 22:46:16 +08:00

10 lines
319 B
SQL

DROP TABLE IF EXISTS sales;
CREATE TABLE sales (DATE_SOLD DateTime64(3, 'UTC'), PRODUCT_ID Nullable(String)) Engine MergeTree() PARTITION BY toYYYYMM(DATE_SOLD) ORDER BY DATE_SOLD;
ALTER TABLE sales ADD PROJECTION test (SELECT toInt64(COUNT(*)) GROUP BY PRODUCT_ID, DATE_SOLD);
SHOW CREATE sales;
DROP TABLE sales;