📄 group_min_max.result
字号:
drop table if exists t1;create table t1 (a1 char(64), a2 char(64), b char(16), c char(16) not null, d char(16), dummy char(64) default ' ');insert into t1 (a1, a2, b, c, d) values('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4'),('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4'),('d','a','a','a411','xy1'),('d','a','a','b411','xy2'),('d','a','a','c411','xy3'),('d','a','a','d411','xy4'),('d','a','b','e412','xy1'),('d','a','b','f412','xy2'),('d','a','b','g412','xy3'),('d','a','b','h412','xy4'),('d','b','a','i421','xy1'),('d','b','a','j421','xy2'),('d','b','a','k421','xy3'),('d','b','a','l421','xy4'),('d','b','b','m422','xy1'),('d','b','b','n422','xy2'),('d','b','b','o422','xy3'),('d','b','b','p422','xy4');create index idx_t1_0 on t1 (a1);create index idx_t1_1 on t1 (a1,a2,b,c);create index idx_t1_2 on t1 (a1,a2,b);analyze table t1;Table Op Msg_type Msg_texttest.t1 analyze status Table is already up to datedrop table if exists t2;create table t2 (a1 char(64), a2 char(64) not null, b char(16), c char(16), d char(16), dummy char(64) default ' ');insert into t2 select * from t1;insert into t2 (a1, a2, b, c, d) values('a','a',NULL,'a777','xyz'),('a','a',NULL,'a888','xyz'),('a','a',NULL,'a999','xyz'),('a','a','a',NULL,'xyz'),('a','a','b',NULL,'xyz'),('a','b','a',NULL,'xyz'),('c','a',NULL,'c777','xyz'),('c','a',NULL,'c888','xyz'),('c','a',NULL,'c999','xyz'),('d','b','b',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('a','a',NULL,'a777','xyz'),('a','a',NULL,'a888','xyz'),('a','a',NULL,'a999','xyz'),('a','a','a',NULL,'xyz'),('a','a','b',NULL,'xyz'),('a','b','a',NULL,'xyz'),('c','a',NULL,'c777','xyz'),('c','a',NULL,'c888','xyz'),('c','a',NULL,'c999','xyz'),('d','b','b',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','a',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz'),('e','a','b',NULL,'xyz');create index idx_t2_0 on t2 (a1);create index idx_t2_1 on t2 (a1,a2,b,c);create index idx_t2_2 on t2 (a1,a2,b);analyze table t2;Table Op Msg_type Msg_texttest.t2 analyze status Table is already up to datedrop table if exists t3;create table t3 (a1 char(1), a2 char(1), b char(1), c char(4) not null, d char(3), dummy char(1) default ' ');insert into t3 (a1, a2, b, c, d) values('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');insert into t3 (a1, a2, b, c, d) values('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');insert into t3 (a1, a2, b, c, d) values('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');insert into t3 (a1, a2, b, c, d) values('a','a','a','a111','xy1'),('a','a','a','b111','xy2'),('a','a','a','c111','xy3'),('a','a','a','d111','xy4'),('a','a','b','e112','xy1'),('a','a','b','f112','xy2'),('a','a','b','g112','xy3'),('a','a','b','h112','xy4'),('a','b','a','i121','xy1'),('a','b','a','j121','xy2'),('a','b','a','k121','xy3'),('a','b','a','l121','xy4'),('a','b','b','m122','xy1'),('a','b','b','n122','xy2'),('a','b','b','o122','xy3'),('a','b','b','p122','xy4'),('b','a','a','a211','xy1'),('b','a','a','b211','xy2'),('b','a','a','c211','xy3'),('b','a','a','d211','xy4'),('b','a','b','e212','xy1'),('b','a','b','f212','xy2'),('b','a','b','g212','xy3'),('b','a','b','h212','xy4'),('b','b','a','i221','xy1'),('b','b','a','j221','xy2'),('b','b','a','k221','xy3'),('b','b','a','l221','xy4'),('b','b','b','m222','xy1'),('b','b','b','n222','xy2'),('b','b','b','o222','xy3'),('b','b','b','p222','xy4'),('c','a','a','a311','xy1'),('c','a','a','b311','xy2'),('c','a','a','c311','xy3'),('c','a','a','d311','xy4'),('c','a','b','e312','xy1'),('c','a','b','f312','xy2'),('c','a','b','g312','xy3'),('c','a','b','h312','xy4'),('c','b','a','i321','xy1'),('c','b','a','j321','xy2'),('c','b','a','k321','xy3'),('c','b','a','l321','xy4'),('c','b','b','m322','xy1'),('c','b','b','n322','xy2'),('c','b','b','o322','xy3'),('c','b','b','p322','xy4');create index idx_t3_0 on t3 (a1);create index idx_t3_1 on t3 (a1,a2,b,c);create index idx_t3_2 on t3 (a1,a2,b);analyze table t3;Table Op Msg_type Msg_texttest.t3 analyze status Table is already up to dateexplain select a1, min(a2) from t1 group by a1;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using index for group-byexplain select a1, max(a2) from t1 group by a1;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range NULL idx_t1_1 65 NULL 5 Using index for group-byexplain select a1, min(a2), max(a2) from t1 group by a1;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using index for group-byexplain select a1, a2, b, min(c), max(c) from t1 group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-byexplain select a1,a2,b,max(c),min(c) from t1 group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-byexplain select a1,a2,b,max(c),min(c) from t2 group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t2 range NULL idx_t2_1 # NULL # Using index for group-byexplain select min(a2), a1, max(a2), min(a2), a1 from t1 group by a1;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using index for group-byexplain select a1, b, min(c), a1, max(c), b, a2, max(c), max(c) from t1 group by a1, a2, b;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-byexplain select min(a2) from t1 group by a1;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range NULL idx_t1_1 130 NULL 5 Using index for group-byexplain select a2, min(c), max(c) from t1 group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using index for group-byselect a1, min(a2) from t1 group by a1;a1 min(a2)a ab ac ad aselect a1, max(a2) from t1 group by a1;a1 max(a2)a bb bc bd bselect a1, min(a2), max(a2) from t1 group by a1;a1 min(a2) max(a2)a a bb a bc a bd a bselect a1, a2, b, min(c), max(c) from t1 group by a1,a2,b;a1 a2 b min(c) max(c)a a a a111 d111a a b e112 h112a b a i121 l121a b b m122 p122b a a a211 d211b a b e212 h212b b a i221 l221b b b m222 p222c a a a311 d311c a b e312 h312c b a i321 l321c b b m322 p322d a a a411 d411d a b e412 h412d b a i421 l421d b b m422 p422select a1,a2,b,max(c),min(c) from t1 group by a1,a2,b;a1 a2 b max(c) min(c)a a a d111 a111a a b h112 e112a b a l121 i121a b b p122 m122b a a d211 a211b a b h212 e212b b a l221 i221b b b p222 m222c a a d311 a311c a b h312 e312c b a l321 i321c b b p322 m322d a a d411 a411d a b h412 e412d b a l421 i421d b b p422 m422select a1,a2,b,max(c),min(c) from t2 group by a1,a2,b;a1 a2 b max(c) min(c)a a NULL a999 a777a a a d111 a111a a b h112 e112a b a l121 i121a b b p122 m122b a a d211 a211b a b h212 e212b b a l221 i221b b b p222 m222c a NULL c999 c777c a a d311 a311c a b h312 e312c b a l321 i321c b b p322 m322d a a d411 a411d a b h412 e412d b a l421 i421d b b p422 m422e a a NULL NULLe a b NULL NULLselect min(a2), a1, max(a2), min(a2), a1 from t1 group by a1;min(a2) a1 max(a2) min(a2) a1a a b a aa b b a ba c b a ca d b a dselect a1, b, min(c), a1, max(c), b, a2, max(c), max(c) from t1 group by a1, a2, b;a1 b min(c) a1 max(c) b a2 max(c) max(c)a a a111 a d111 a a d111 d111a b e112 a h112 b a h112 h112a a i121 a l121 a b l121 l121a b m122 a p122 b b p122 p122b a a211 b d211 a a d211 d211b b e212 b h212 b a h212 h212b a i221 b l221 a b l221 l221b b m222 b p222 b b p222 p222c a a311 c d311 a a d311 d311c b e312 c h312 b a h312 h312c a i321 c l321 a b l321 l321c b m322 c p322 b b p322 p322d a a411 d d411 a a d411 d411d b e412 d h412 b a h412 h412d a i421 d l421 a b l421 l421d b m422 d p422 b b p422 p422select min(a2) from t1 group by a1;min(a2)aaaaselect a2, min(c), max(c) from t1 group by a1,a2,b;a2 min(c) max(c)a a111 d111a e112 h112b i121 l121b m122 p122a a211 d211a e212 h212b i221 l221b m222 p222a a311 d311a e312 h312b i321 l321b m322 p322a a411 d411a e412 h412b i421 l421b m422 p422explain select a1,a2,b,min(c),max(c) from t1 where a1 < 'd' group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 10 Using where; Using index for group-byexplain select a1,a2,b,min(c),max(c) from t1 where a1 >= 'b' group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 14 Using where; Using index for group-byexplain select a1,a2,b, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 14 Using where; Using index for group-byexplain select a1, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 14 Using where; Using index for group-byexplain select a1,a2,b,min(c),max(c) from t1 where a1 >= 'c' or a2 < 'b' group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 17 Using where; Using index for group-byexplain select a1,a2,b, max(c) from t1 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 10 Using where; Using index for group-byexplain select a1,a2,b,min(c),max(c) from t1 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 10 Using where; Using index for group-byexplain select a1,a2,b, max(c) from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 10 Using where; Using index for group-byexplain select a1,a2,b,min(c),max(c) from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 10 Using where; Using index for group-byexplain select a1,min(c),max(c) from t1 where a1 >= 'b' group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 14 Using where; Using index for group-byexplain select a1, max(c) from t1 where a1 in ('a','b','d') group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 147 NULL 14 Using where; Using index for group-byexplain select a1,a2,b, max(c) from t2 where a1 < 'd' group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-byexplain select a1,a2,b,min(c),max(c) from t2 where a1 < 'd' group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-byexplain select a1,a2,b,min(c),max(c) from t2 where a1 >= 'b' group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-byexplain select a1,a2,b, max(c) from t2 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-byexplain select a1, max(c) from t2 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-byexplain select a1,a2,b,min(c),max(c) from t2 where a1 >= 'c' or a2 < 'b' group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-byexplain select a1,a2,b, max(c) from t2 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-byexplain select a1,a2,b,min(c),max(c) from t2 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 163 NULL # Using where; Using index for group-by
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -