3
3
insert into t1 values ('000000000001'),('000000000002');
4
4
explain select * from t1 where id=000000000001;
5
5
id select_type table type possible_keys key key_len ref rows Extra
6
1 SIMPLE t1 index PRIMARY PRIMARY 50 NULL 2 Using where; Using index
6
1 SIMPLE t1 index PRIMARY PRIMARY 12 NULL 2 Using where; Using index
7
7
select * from t1 where id=000000000001;
42
42
SELECT CHAR(30) = '', '' = CHAR(30);
43
43
CHAR(30) = '' '' = CHAR(30)
45
create table t1 (a int,b varbinary(1));
45
create table t1 (a tinyint(1),b binary(1));
46
46
insert into t1 values (0x01,0x01);
47
47
select * from t1 where a=b;
50
Warning 1292 Truncated incorrect DOUBLE value: ''
49
51
select * from t1 where a=b and b=0x01;
54
Warning 1292 Truncated incorrect DOUBLE value: ''
51
55
drop table if exists t1;
52
CREATE TABLE t1 (b int, c int);
56
CREATE TABLE t1 (b int(2) zerofill, c int(2) zerofill);
53
57
INSERT INTO t1 (b,c) VALUES (1,2), (1,1), (2,2);
54
58
SELECT CONCAT(b,c), CONCAT(b,c) = '0101' FROM t1;
55
59
CONCAT(b,c) CONCAT(b,c) = '0101'
59
63
EXPLAIN EXTENDED SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101';
60
64
id select_type table type possible_keys key key_len ref rows filtered Extra
61
65
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
63
Note 1003 select `test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where ((`test`.`t1`.`b` = 1) and (concat(1,`test`.`t1`.`c`) = '0101'))
67
Note 1003 select "test"."t1"."b" AS "b","test"."t1"."c" AS "c" from "test"."t1" where (("test"."t1"."b" = 1) and (concat('01',"test"."t1"."c") = '0101'))
64
68
SELECT b,c FROM t1 WHERE b = 1 AND CONCAT(b,c) = '0101';
66
71
CREATE TABLE t2 (a int);
67
72
INSERT INTO t2 VALUES (1),(2);
84
89
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
85
90
Note 1276 Field or reference 'test.t2.a' of SELECT #2 was resolved in SELECT #1
86
Note 1003 select `test`.`t2`.`a` AS `a`,(select count(0) AS `COUNT(*)` from `test`.`t1` where ((`test`.`t1`.`b` = `test`.`t2`.`a`) and (concat(`test`.`t1`.`b`,`test`.`t1`.`c`) = concat('0',`test`.`t2`.`a`,'01')))) AS `x` from `test`.`t2` order by `test`.`t2`.`a`
91
Note 1003 select "test"."t2"."a" AS "a",(select count(0) AS "COUNT(*)" from "test"."t1" where (("test"."t1"."b" = "test"."t2"."a") and (concat("test"."t1"."b","test"."t1"."c") = concat('0',"test"."t2"."a",'01')))) AS "x" from "test"."t2" order by "test"."t2"."a"