ClickHouse/tests/queries/0_stateless/00687_insert_into_mv.sql
Ivan 97f2a2213e
Move all folders inside /dbms one level up (#9974)
* Move some code outside dbms/src folder
* Fix paths
2020-04-02 02:51:21 +03:00

32 lines
822 B
SQL

DROP TABLE IF EXISTS test_00687;
DROP TABLE IF EXISTS mv_bad;
DROP TABLE IF EXISTS mv_good;
DROP TABLE IF EXISTS mv_group;
CREATE TABLE test_00687 (x String) ENGINE = Null;
create MATERIALIZED VIEW mv_bad (x String)
ENGINE = MergeTree Partition by tuple() order by tuple()
AS SELECT DISTINCT x FROM test_00687;
create MATERIALIZED VIEW mv_good (x String)
ENGINE = MergeTree Partition by tuple() order by tuple()
AS SELECT x FROM test_00687;
create MATERIALIZED VIEW mv_group (x String)
ENGINE = MergeTree Partition by tuple() order by tuple()
AS SELECT x FROM test_00687 group by x;
insert into test_00687 values ('stest'), ('stest');
select * from mv_bad;
SELECT '---';
select * from mv_good;
SELECT '---';
select * from mv_group;
DROP TABLE mv_bad;
DROP TABLE mv_good;
DROP TABLE mv_group;
DROP TABLE test_00687;