mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-11 08:52:06 +00:00
16 lines
425 B
MySQL
16 lines
425 B
MySQL
|
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;
|