📄 group_min_max.result
字号:
d a a a411 d411d a b e412 h412d b a i421 j421select a1,a2,b, max(c) from t1 where (c < 'a0') or (c > 'b1') group by a1,a2,b;a1 a2 b max(c)a a a d111a a b h112a b a l121a b b p122b a a d211b a b h212b b a l221b b b p222c a a d311c a b h312c b a l321c b b p322d a a d411d a b h412d b a l421d b b p422select a1,a2,b,min(c),max(c) from t1 where (c < 'a0') or (c > 'b1') group by a1,a2,b;a1 a2 b min(c) max(c)a a a b111 d111a a b e112 h112a b a i121 l121a b b m122 p122b a a b211 d211b a b e212 h212b b a i221 l221b b b m222 p222c a a b311 d311c a b e312 h312c b a i321 l321c b b m322 p322d a a b411 d411d a b e412 h412d b a i421 l421d b b m422 p422select a1,a2,b, max(c) from t1 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;a1 a2 b max(c)a a a d111a a b h112a b a l121a b b p122b a a d211b a b h212b b a l221b b b p222c a a d311c a b h312c b a l321c b b p322d a a d411d a b h412d b a l421d b b p422select a1,a2,b,min(c),max(c) from t1 where (c > 'b1') or (c <= 'g1') 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,min(c),max(c) from t1 where (c > 'b111') and (c <= 'g112') group by a1,a2,b;a1 a2 b min(c) max(c)a a a c111 d111a a b e112 g112b a a b211 d211b a b e212 f212c a a b311 d311c a b e312 f312d a a b411 d411d a b e412 f412select a1,a2,b,min(c),max(c) from t1 where (c < 'c5') or (c = 'g412') or (c = 'k421') group by a1,a2,b;a1 a2 b min(c) max(c)a a a a111 c111b a a a211 c211c a a a311 c311d a a a411 c411d a b g412 g412d b a k421 k421select a1,a2,b,min(c),max(c) from t1 where ((c > 'b111') and (c <= 'g112')) or ((c > 'd000') and (c <= 'i110')) group by a1,a2,b;a1 a2 b min(c) max(c)a a a c111 d111a a b e112 h112b a a b211 d211b a b e212 h212c a a b311 d311c a b e312 h312d a a b411 d411d a b e412 h412select a1,a2,b,min(c),max(c) from t1 where (c between 'b111' and 'g112') or (c between 'd000' and 'i110') group by a1,a2,b;a1 a2 b min(c) max(c)a a a b111 d111a a b e112 h112b a a b211 d211b a b e212 h212c a a b311 d311c a b e312 h312d a a b411 d411d a b e412 h412select a1,a2,b, max(c) from t2 where (c > 'b1') group by a1,a2,b;a1 a2 b max(c)a a a d111a a b h112a b a l121a b b p122b a a d211b a b h212b b a l221b b b p222c a NULL c999c a a d311c a b h312c b a l321c b b p322d a a d411d a b h412d b a l421d b b p422select a1,a2,b,min(c),max(c) from t2 where (c > 'b1') group by a1,a2,b;a1 a2 b min(c) max(c)a a a b111 d111a a b e112 h112a b a i121 l121a b b m122 p122b a a b211 d211b a b e212 h212b b a i221 l221b b b m222 p222c a NULL c777 c999c a a b311 d311c a b e312 h312c b a i321 l321c b b m322 p322d a a b411 d411d a b e412 h412d b a i421 l421d b b m422 p422select a1,a2,b, max(c) from t2 where (c > 'f123') group by a1,a2,b;a1 a2 b max(c)a a b h112a b a l121a b b p122b a b h212b b a l221b b b p222c a b h312c b a l321c b b p322d a b h412d b a l421d b b p422select a1,a2,b,min(c),max(c) from t2 where (c > 'f123') group by a1,a2,b;a1 a2 b min(c) max(c)a a b g112 h112a b a i121 l121a b b m122 p122b a b f212 h212b b a i221 l221b b b m222 p222c a b f312 h312c b a i321 l321c b b m322 p322d a b f412 h412d b a i421 l421d b b m422 p422select a1,a2,b, max(c) from t2 where (c < 'a0') group by a1,a2,b;a1 a2 b max(c)select a1,a2,b,min(c),max(c) from t2 where (c < 'a0') group by a1,a2,b;a1 a2 b min(c) max(c)select a1,a2,b, max(c) from t2 where (c < 'k321') group by a1,a2,b;a1 a2 b max(c)a a NULL a999a a a d111a a b h112a b a k121b a a d211b a b h212b b a k221c a NULL c999c a a d311c a b h312c b a j321d a a d411d a b h412d b a j421select a1,a2,b,min(c),max(c) from t2 where (c < 'k321') group by a1,a2,b;a1 a2 b min(c) max(c)a a NULL a777 a999a a a a111 d111a a b e112 h112a b a i121 k121b a a a211 d211b a b e212 h212b b a i221 k221c a NULL c777 c999c a a a311 d311c a b e312 h312c b a i321 j321d a a a411 d411d a b e412 h412d b a i421 j421select a1,a2,b, max(c) from t2 where (c < 'a0') or (c > 'b1') group by a1,a2,b;a1 a2 b max(c)a a a d111a a b h112a b a l121a b b p122b a a d211b a b h212b b a l221b b b p222c a NULL c999c a a d311c a b h312c b a l321c b b p322d a a d411d a b h412d b a l421d b b p422select a1,a2,b,min(c),max(c) from t2 where (c < 'a0') or (c > 'b1') group by a1,a2,b;a1 a2 b min(c) max(c)a a a b111 d111a a b e112 h112a b a i121 l121a b b m122 p122b a a b211 d211b a b e212 h212b b a i221 l221b b b m222 p222c a NULL c777 c999c a a b311 d311c a b e312 h312c b a i321 l321c b b m322 p322d a a b411 d411d a b e412 h412d b a i421 l421d b b m422 p422select a1,a2,b, max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;a1 a2 b max(c)a a NULL a999a a a d111a a b h112a b a l121a b b p122b a a d211b a b h212b b a l221b b b p222c a NULL c999c a a d311c a b h312c b a l321c b b p322d a a d411d a b h412d b a l421d b b p422select a1,a2,b,min(c),max(c) from t2 where (c > 'b1') or (c <= 'g1') group by a1,a2,b;a1 a2 b min(c) max(c)a a NULL a777 a999a 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 NULL c777 c999c 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,min(c),max(c) from t2 where (c > 'b111') and (c <= 'g112') group by a1,a2,b;a1 a2 b min(c) max(c)a a a c111 d111a a b e112 g112b a a b211 d211b a b e212 f212c a NULL c777 c999c a a b311 d311c a b e312 f312d a a b411 d411d a b e412 f412select a1,a2,b,min(c),max(c) from t2 where (c < 'c5') or (c = 'g412') or (c = 'k421') group by a1,a2,b;a1 a2 b min(c) max(c)a a NULL a777 a999a a a a111 c111b a a a211 c211c a a a311 c311d a a a411 c411d a b g412 g412d b a k421 k421select a1,a2,b,min(c),max(c) from t2 where ((c > 'b111') and (c <= 'g112')) or ((c > 'd000') and (c <= 'i110')) group by a1,a2,b;a1 a2 b min(c) max(c)a a a c111 d111a a b e112 h112b a a b211 d211b a b e212 h212c a NULL c777 c999c a a b311 d311c a b e312 h312d a a b411 d411d a b e412 h412explain select a1,a2,b,min(c),max(c) from t1where exists ( select * from t2 where t2.c = t1.c )group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 PRIMARY t1 index NULL idx_t1_1 163 NULL 128 Using where; Using index2 DEPENDENT SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using where; Using indexexplain select a1,a2,b,min(c),max(c) from t1where exists ( select * from t2 where t2.c > 'b1' )group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra1 PRIMARY t1 range NULL idx_t1_1 147 NULL 17 Using index for group-by2 SUBQUERY t2 index NULL idx_t2_1 163 NULL 164 Using where; Using indexexplain select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (b > '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 17 Using where; Using index for group-byexplain select a1,a2,b,min(c),max(c) from t1 where (a1 >= 'c' or a2 < 'b') and (c > 'b111') 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 163 NULL 17 Using where; Using index for group-byexplain select a1,a2,b,min(c),max(c) from t1 where (a2 >= 'b') and (b = 'a') and (c > 'b111') group by a1,a2,b;id select_type table type possible_keys key key_len ref rows Extra
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -