ClickHouse/dbms/tests/queries/0_stateless/00717_low_cardinaliry_group_by.sql

23 lines
1.1 KiB
MySQL
Raw Normal View History

drop table if exists tab;
create table tab (a String, b StringWithDictionary) engine = MergeTree order by a;
insert into tab values ('a_1', 'b_1'), ('a_2', 'b_2');
select count() from tab;
select a from tab group by a order by a;
select b from tab group by b order by b;
select length(b) as l from tab group by l;
select sum(length(a)), b from tab group by b order by b;
select sum(length(b)), a from tab group by a order by a;
select a, b from tab group by a, b order by a, b;
select sum(length(a)) from tab group by b, b || '_';
select length(b) as l from tab group by l;
select length(b) as l from tab group by l, l + 1;
select length(b) as l from tab group by l, l + 1, l + 2;
select length(b) as l from tab group by l, l + 1, l + 2, l + 3;
select length(b) as l from tab group by l, l + 1, l + 2, l + 3, l + 4;
select length(b) as l from tab group by l, l + 1, l + 2, l + 3, l + 4, l + 5;
select a, length(b) as l from tab group by a, l, l + 1 order by a;
select b, length(b) as l from tab group by b, l, l + 1 order by b;
select a, b, length(b) as l from tab group by a, b, l, l + 1 order by a, b;
drop table if exists tab;