mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-10-19 06:50:50 +00:00
16 lines
670 B
SQL
16 lines
670 B
SQL
drop table if exists test.lc;
|
|
drop table if exists test.lc_mv;
|
|
|
|
create table test.lc (str StringWithDictionary) engine = MergeTree order by tuple();
|
|
|
|
insert into test.lc values ('a'), ('bbb'), ('ab'), ('accccc'), ('baasddas'), ('bcde');
|
|
|
|
CREATE MATERIALIZED VIEW test.lc_mv ENGINE = AggregatingMergeTree() ORDER BY tuple() populate AS SELECT substring(str, 1, 1) as letter, min(length(str)) AS min_len, max(length(str)) AS max_len FROM test.lc GROUP BY substring(str, 1, 1);
|
|
|
|
insert into test.lc values ('a'), ('bbb'), ('ab'), ('accccc'), ('baasddas'), ('bcde');
|
|
select * from test.lc_mv order by letter;
|
|
|
|
drop table if exists test.lc;
|
|
drop table if exists test.lc_mv;
|
|
|