ClickHouse/tests/queries/0_stateless/00984_materialized_view_to_columns.sql

16 lines
425 B
MySQL
Raw Normal View History

DROP TABLE IF EXISTS test1;
DROP TABLE IF EXISTS test2;
DROP TABLE IF EXISTS mv;
CREATE TABLE test1 (a UInt8, b String) ENGINE MergeTree ORDER BY a;
CREATE TABLE test2 (c UInt8, d String) ENGINE MergeTree ORDER BY c;
CREATE MATERIALIZED VIEW mv TO test1 (b String, a UInt8) AS SELECT d AS b, c AS a FROM test2;
INSERT INTO test2 VALUES (1, 'test');
SELECT * FROM test1;
DROP TABLE test1;
DROP TABLE test2;
DROP TABLE mv;