2019-04-18 18:48:04 +00:00
|
|
|
drop table if exists lc_00752;
|
|
|
|
drop table if exists lc_mv_00752;
|
2018-11-01 17:21:21 +00:00
|
|
|
|
2019-04-18 18:48:04 +00:00
|
|
|
create table lc_00752 (str StringWithDictionary) engine = MergeTree order by tuple();
|
2018-11-01 17:21:21 +00:00
|
|
|
|
2019-04-18 18:48:04 +00:00
|
|
|
insert into lc_00752 values ('a'), ('bbb'), ('ab'), ('accccc'), ('baasddas'), ('bcde');
|
2018-11-01 17:21:21 +00:00
|
|
|
|
2019-04-18 18:48:04 +00:00
|
|
|
CREATE MATERIALIZED VIEW lc_mv_00752 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 lc_00752 GROUP BY substring(str, 1, 1);
|
2018-11-01 17:21:21 +00:00
|
|
|
|
2019-04-18 18:48:04 +00:00
|
|
|
insert into lc_00752 values ('a'), ('bbb'), ('ab'), ('accccc'), ('baasddas'), ('bcde');
|
|
|
|
select * from lc_mv_00752 order by letter;
|
2018-11-01 17:21:21 +00:00
|
|
|
|
2019-04-18 18:48:04 +00:00
|
|
|
drop table if exists lc_00752;
|
|
|
|
drop table if exists lc_mv_00752;
|
2018-11-01 17:21:21 +00:00
|
|
|
|