📄 group_min_max.result
字号:
explain select a1,a2,b, max(c) from t2 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 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 = '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 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,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, max(c) from t2 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 t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-byselect a1,a2,b,min(c),max(c) from t1 where a1 < 'd' 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 p322select a1,a2,b,min(c),max(c) from t1 where a1 >= 'b' group by a1,a2,b;a1 a2 b min(c) max(c)b 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) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;a1 a2 b max(c)a a a d111a a b h112a b a l121a b b p122c 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, max(c) from t1 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;a1 max(c)a d111a h112a l121a p122c d311c h312c l321c p322d d411d h412d l421d p422select a1,a2,b,min(c),max(c) from t1 where a1 >= 'c' or a2 < 'b' group by a1,a2,b;a1 a2 b min(c) max(c)a a a a111 d111a a b e112 h112b a a a211 d211b a b e212 h212c 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) from t1 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;a1 a2 b max(c)b a a d211b a b h212b b a l221b b b p222d a a d411d a b h412d b a l421d b b p422select a1,a2,b,min(c),max(c) from t1 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;a1 a2 b min(c) max(c)b a a a211 d211b a b e212 h212b b a i221 l221b b b m222 p222d a a a411 d411d a b e412 h412d b a i421 l421d b b m422 p422select 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;a1 a2 b max(c)a b a l121a b b p122b b a l221b b b p222c b a l321c b b p322d b a l421d b b p422select 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;a1 a2 b min(c) max(c)a b a i121 l121a b b m122 p122b b a i221 l221b b b m222 p222c b a i321 l321c b b m322 p322d b a i421 l421d b b m422 p422select a1,min(c),max(c) from t1 where a1 >= 'b' group by a1,a2,b;a1 min(c) max(c)b a211 d211b e212 h212b i221 l221b m222 p222c a311 d311c e312 h312c i321 l321c m322 p322d a411 d411d e412 h412d i421 l421d m422 p422select a1, max(c) from t1 where a1 in ('a','b','d') group by a1,a2,b;a1 max(c)a d111a h112a l121a p122b d211b h212b l221b p222d d411d h412d l421d p422select a1,a2,b, max(c) from t2 where a1 < 'd' 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 p322select a1,a2,b,min(c),max(c) from t2 where a1 < 'd' 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 p322select a1,a2,b,min(c),max(c) from t2 where a1 >= 'b' group by a1,a2,b;a1 a2 b min(c) max(c)b 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 p422e a a NULL NULLe a b NULL NULLselect a1,a2,b, max(c) from t2 where a1 >= 'c' or a1 < 'b' 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 p122c 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 p422e a a NULLe a b NULLselect a1, max(c) from t2 where a1 >= 'c' or a1 < 'b' group by a1,a2,b;a1 max(c)a a999a d111a h112a l121a p122c c999c d311c h312c l321c p322d d411d h412d l421d p422e NULLe NULLselect a1,a2,b,min(c),max(c) from t2 where a1 >= 'c' or a2 < 'b' group by a1,a2,b;a1 a2 b min(c) max(c)a a NULL a777 a999a a a a111 d111a a b e112 h112b a a a211 d211b a b e212 h212c 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 p422e a a NULL NULLe a b NULL NULLselect a1,a2,b, max(c) from t2 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;a1 a2 b max(c)b a a d211b a b h212b b a l221b b b p222d a a d411d a b h412d b a l421d b b p422select a1,a2,b,min(c),max(c) from t2 where a1 = 'z' or a1 = 'b' or a1 = 'd' group by a1,a2,b;a1 a2 b min(c) max(c)b a a a211 d211b a b e212 h212b b a i221 l221b b b m222 p222d a a a411 d411d a b e412 h412d b a i421 l421d b b m422 p422select a1,a2,b, max(c) from t2 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b;a1 a2 b max(c)a b a l121a b b p122b b a l221b b b p222c b a l321c b b p322d b a l421d b b p422select a1,a2,b,min(c),max(c) from t2 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') group by a1,a2,b;a1 a2 b min(c) max(c)a b a i121 l121a b b m122 p122b b a i221 l221b b b m222 p222c b a i321 l321c b b m322 p322d b a i421 l421d b b m422 p422select a1,min(c),max(c) from t2 where a1 >= 'b' group by a1,a2,b;a1 min(c) max(c)b a211 d211b e212 h212b i221 l221b m222 p222c c777 c999c a311 d311c e312 h312c i321 l321c m322 p322d a411 d411d e412 h412d i421 l421d m422 p422e NULL NULLe NULL NULLselect a1, max(c) from t2 where a1 in ('a','b','d') group by a1,a2,b;a1 max(c)a a999a d111a h112a l121a p122b d211b h212b l221b p222d d411d h412d l421d p422explain select a1,a2,b,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range NULL idx_t1_1 147 NULL 5 Using where; Using index for group-byexplain select a1,max(c),min(c) from t1 where (a2 = 'a') and (b = 'b') group by a1;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range NULL idx_t1_1 147 NULL 5 Using where; Using index for group-byexplain select a1,a2,b, max(c) from t1 where (b = 'b') group by a1,a2;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range NULL idx_t1_1 147 NULL 9 Using where; Using index for group-byexplain select a1,a2,b,min(c),max(c) from t1 where (b = 'b') group by a1,a2;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range NULL idx_t1_1 147 NULL 9 Using where; Using index for group-byexplain select a1,a2, max(c) from t1 where (b = 'b') group by a1,a2;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t1 range NULL idx_t1_1 147 NULL 9 Using where; Using index for group-byexplain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1;id select_type table type possible_keys key key_len ref rows Extra1 SIMPLE t2 range NULL idx_t2_1 163 NULL 5 Using where; Using index for group-byexplain select a1,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -