1391
1391
34 70 absentee vest 17788966 254128.0857 3272.5940 10709871.3069
1392
1392
select companynr,t2nr,count(price),sum(price),min(price),max(price),avg(price) from t3 where companynr = 37 group by companynr,t2nr limit 10;
1393
1393
companynr t2nr count(price) sum(price) min(price) max(price) avg(price)
1394
37 1 1 5987435 5987435 5987435 39654943.0000
1395
37 2 1 28357832 28357832 28357832 39654943.0000
1394
37 1 1 5987435 5987435 5987435 5987435.0000
1395
37 2 1 28357832 28357832 28357832 28357832.0000
1396
1396
37 3 1 39654943 39654943 39654943 39654943.0000
1397
37 11 1 5987435 5987435 5987435 39654943.0000
1398
37 12 1 28357832 28357832 28357832 39654943.0000
1397
37 11 1 5987435 5987435 5987435 5987435.0000
1398
37 12 1 28357832 28357832 28357832 28357832.0000
1399
1399
37 13 1 39654943 39654943 39654943 39654943.0000
1400
37 21 1 5987435 5987435 5987435 39654943.0000
1401
37 22 1 28357832 28357832 28357832 39654943.0000
1400
37 21 1 5987435 5987435 5987435 5987435.0000
1401
37 22 1 28357832 28357832 28357832 28357832.0000
1402
1402
37 23 1 39654943 39654943 39654943 39654943.0000
1403
37 31 1 5987435 5987435 5987435 39654943.0000
1403
37 31 1 5987435 5987435 5987435 5987435.0000
1404
1404
select /*! SQL_SMALL_RESULT */ companynr,t2nr,count(price),sum(price),min(price),max(price),avg(price) from t3 where companynr = 37 group by companynr,t2nr limit 10;
1405
1405
companynr t2nr count(price) sum(price) min(price) max(price) avg(price)
1406
37 1 1 5987435 5987435 5987435 39654943.0000
1407
37 2 1 28357832 28357832 28357832 39654943.0000
1406
37 1 1 5987435 5987435 5987435 5987435.0000
1407
37 2 1 28357832 28357832 28357832 28357832.0000
1408
1408
37 3 1 39654943 39654943 39654943 39654943.0000
1409
37 11 1 5987435 5987435 5987435 39654943.0000
1410
37 12 1 28357832 28357832 28357832 39654943.0000
1409
37 11 1 5987435 5987435 5987435 5987435.0000
1410
37 12 1 28357832 28357832 28357832 28357832.0000
1411
1411
37 13 1 39654943 39654943 39654943 39654943.0000
1412
37 21 1 5987435 5987435 5987435 39654943.0000
1413
37 22 1 28357832 28357832 28357832 39654943.0000
1412
37 21 1 5987435 5987435 5987435 5987435.0000
1413
37 22 1 28357832 28357832 28357832 28357832.0000
1414
1414
37 23 1 39654943 39654943 39654943 39654943.0000
1415
37 31 1 5987435 5987435 5987435 39654943.0000
1415
37 31 1 5987435 5987435 5987435 5987435.0000
1416
1416
select companynr,count(price),sum(price),min(price),max(price),avg(price) from t3 group by companynr ;
1417
1417
companynr count(price) sum(price) min(price) max(price) avg(price)
1418
1418
37 12543 309394878010 5987435 39654943 24666736.6667
1936
1936
Tables_in_test (t?)
1937
1937
show columns from t2;
1938
1938
Field Type Null Default Default_is_NULL On_Update
1939
auto INTEGER FALSE FALSE
1940
fld1 INTEGER FALSE 0 FALSE
1941
companynr INTEGER FALSE 0 FALSE
1942
fld3 VARCHAR FALSE FALSE
1943
fld4 VARCHAR FALSE FALSE
1944
fld5 VARCHAR FALSE FALSE
1945
fld6 VARCHAR FALSE FALSE
1940
fld1 INTEGER NO 0 NO
1941
companynr INTEGER NO 0 NO
1946
1946
show columns from t2 from test like 'f%';
1947
1947
Field Type Null Default Default_is_NULL On_Update
1948
auto INTEGER FALSE FALSE
1949
fld1 INTEGER FALSE 0 FALSE
1950
companynr INTEGER FALSE 0 FALSE
1951
fld3 VARCHAR FALSE FALSE
1952
fld4 VARCHAR FALSE FALSE
1953
fld5 VARCHAR FALSE FALSE
1954
fld6 VARCHAR FALSE FALSE
1949
fld1 INTEGER NO 0 NO
1950
companynr INTEGER NO 0 NO
1955
1955
show columns from t2 from test like 's%';
1956
1956
Field Type Null Default Default_is_NULL On_Update
1957
auto INTEGER FALSE FALSE
1958
fld1 INTEGER FALSE 0 FALSE
1959
companynr INTEGER FALSE 0 FALSE
1960
fld3 VARCHAR FALSE FALSE
1961
fld4 VARCHAR FALSE FALSE
1962
fld5 VARCHAR FALSE FALSE
1963
fld6 VARCHAR FALSE FALSE
1958
fld1 INTEGER NO 0 NO
1959
companynr INTEGER NO 0 NO
1964
1964
drop table t4, t3, t2, t1;
1965
1965
CREATE TABLE t1 (
1966
1966
id bigint NOT NULL auto_increment,
2244
2244
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 USE INDEX (a) ON t1.a=t2.a;
2245
2245
id select_type table type possible_keys key key_len ref rows Extra
2246
2246
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
2247
1 SIMPLE t2 ref a a 23 test.t1.a 1
2247
1 SIMPLE t2 ref a a 23 test.t1.a 2
2248
2248
EXPLAIN SELECT * FROM t1 LEFT JOIN t2 FORCE INDEX (a) ON t1.a=t2.a;
2249
2249
id select_type table type possible_keys key key_len ref rows Extra
2250
2250
1 SIMPLE t1 ALL NULL NULL NULL NULL 5
2251
1 SIMPLE t2 ref a a 23 test.t1.a 1
2251
1 SIMPLE t2 ref a a 23 test.t1.a 2
2252
2252
DROP TABLE t1, t2;
2253
2253
CREATE TABLE t1 ( city char(30) );
2254
2254
INSERT INTO t1 VALUES ('London');
2935
2935
insert into t2 select A.a, B.a, C.a, C.a from t1 A, t1 B, t1 C;
2936
2936
analyze table t2;
2937
2937
Table Op Msg_type Msg_text
2938
test.t2 analyze note The storage engine for the table doesn't support analyze
2938
test.t2 analyze status OK
2939
2939
select 'In next EXPLAIN, B.rows must be exactly 10:' Z;
2941
2941
In next EXPLAIN, B.rows must be exactly 10:
2952
2952
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6;
2953
2953
id select_type table type possible_keys key key_len ref rows Extra
2954
1 SIMPLE t1 ALL PRIMARY,b NULL NULL NULL 10 Using where
2955
1 SIMPLE t2 ref c c 5 test.t1.a 1
2954
1 SIMPLE t2 ALL c NULL NULL NULL 18
2955
1 SIMPLE t1 eq_ref PRIMARY,b PRIMARY 4 test.t2.c 1 Using where
2957
2957
SELECT a, c, d, f FROM t1,t2 WHERE a=c AND b BETWEEN 4 AND 6 AND a > 0;
2958
2958
id select_type table type possible_keys key key_len ref rows Extra
2959
1 SIMPLE t1 ALL PRIMARY,b NULL NULL NULL 10 Using where
2960
1 SIMPLE t2 ref c c 5 test.t1.a 1
2959
1 SIMPLE t2 ALL c NULL NULL NULL 18 Using where
2960
1 SIMPLE t1 eq_ref PRIMARY,b PRIMARY 4 test.t2.c 1 Using where
2961
2961
DROP TABLE t1, t2;
2962
2962
create table t1 (
2963
2963
a int not null auto_increment primary key,
3090
3090
id select_type table type possible_keys key key_len ref rows Extra
3091
3091
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
3092
3092
1 SIMPLE t3 range PRIMARY,ci ci 19 NULL 2 Using where
3093
1 SIMPLE t2 ref si,ai ai 5 test.t3.a 1 Using where
3093
1 SIMPLE t2 ref si,ai ai 5 test.t3.a 2 Using where
3095
3095
SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3
3096
3096
WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND
3212
3212
INSERT INTO t1 VALUES (30,"2006-01-03 23:00:00"), (31,"2006-01-03 23:00:00");
3213
3213
ANALYZE TABLE t1;
3214
3214
Table Op Msg_type Msg_text
3215
test.t1 analyze note The storage engine for the table doesn't support analyze
3215
test.t1 analyze status OK
3216
3216
CREATE TABLE t2 (a INT, dt1 DATETIME, dt2 DATETIME, PRIMARY KEY (a));
3217
3217
INSERT INTO t2 VALUES (30, "2006-01-01 00:00:00", "2999-12-31 00:00:00");
3218
3218
INSERT INTO t2 SELECT a+1,dt1,dt2 FROM t2;
3219
3219
ANALYZE TABLE t2;
3220
3220
Table Op Msg_type Msg_text
3221
test.t2 analyze note The storage engine for the table doesn't support analyze
3221
test.t2 analyze status OK
3223
3223
SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30
3224
3224
AND t1.ts BETWEEN t2.dt1 AND t2.dt2
3250
3250
show create table t1;
3251
3251
Table Create Table
3252
3252
t1 CREATE TABLE `t1` (
3253
`i` decimal(19,0) NOT NULL,
3254
`c` decimal(19,0) NOT NULL,
3255
`co` decimal(19,0) NOT NULL
3253
`i` DECIMAL(19,0) NOT NULL,
3254
`c` DECIMAL(19,0) NOT NULL,
3255
`co` DECIMAL(19,0) NOT NULL
3256
) ENGINE=PBXT COLLATE = utf8_general_ci
3259
3259
if(1, 1111111111111111111, 1) i,
3454
3454
WHERE 1 AND f1.b NOT IN (100,2232,3343,51111);
3455
3455
id select_type table type possible_keys key key_len ref rows Extra
3456
3456
1 SIMPLE f1 ALL inx NULL NULL NULL 7 Using where
3457
1 SIMPLE f2 ref inx inx 5 test.f1.b 1 Using where
3457
1 SIMPLE f2 ALL inx NULL NULL NULL 7 Using where; Using join buffer
3459
3459
CREATE TABLE t1 (c1 INT, c2 INT);
3460
3460
INSERT INTO t1 VALUES (1,11), (2,22), (2,22);