1 drop table if exists t1,t2,t3,t4;
2 drop database if exists mysqltest;
3 create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb;
4 insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
5 select id, code, name from t1 order by id;
14 update ignore t1 set id = 8, name = 'Sinisa' where id < 3;
15 select id, code, name from t1 order by id;
24 update ignore t1 set id = id + 10, name = 'Ralph' where id < 4;
25 select id, code, name from t1 order by id;
36 id int(11) NOT NULL auto_increment,
37 parent_id int(11) DEFAULT '0' NOT NULL,
38 level tinyint(4) DEFAULT '0' NOT NULL,
40 KEY parent_id (parent_id),
43 INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1),(179,5,2);
44 update t1 set parent_id=parent_id+100;
45 select * from t1 where parent_id=102;
50 update t1 set id=id+1000;
51 update t1 set id=1024 where id=1009;
52 Got one of the listed errors
94 update ignore t1 set id=id+1;
136 update ignore t1 set id=1023 where id=1010;
137 select * from t1 where parent_id=102;
142 explain select level from t1 where level=1;
143 id select_type table type possible_keys key key_len ref rows Extra
144 1 SIMPLE t1 ref level level 1 const # Using index
145 explain select level,id from t1 where level=1;
146 id select_type table type possible_keys key key_len ref rows Extra
147 1 SIMPLE t1 ref level level 1 const # Using index
148 explain select level,id,parent_id from t1 where level=1;
149 id select_type table type possible_keys key key_len ref rows Extra
150 1 SIMPLE t1 ref level level 1 const #
151 select level,id from t1 where level=1;
159 select level,id,parent_id from t1 where level=1;
168 Table Op Msg_type Msg_text
169 test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
170 test.t1 optimize status OK
172 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
173 t1 0 PRIMARY 1 id A # NULL NULL BTREE
174 t1 1 parent_id 1 parent_id A # NULL NULL BTREE
175 t1 1 level 1 level A # NULL NULL BTREE
178 gesuchnr int(11) DEFAULT '0' NOT NULL,
179 benutzer_id int(11) DEFAULT '0' NOT NULL,
180 PRIMARY KEY (gesuchnr,benutzer_id)
182 replace into t1 (gesuchnr,benutzer_id) values (2,1);
183 replace into t1 (gesuchnr,benutzer_id) values (1,1);
184 replace into t1 (gesuchnr,benutzer_id) values (1,1);
190 create table t1 (a int) engine=innodb;
191 insert into t1 values (1), (2);
193 Table Op Msg_type Msg_text
194 test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
195 test.t1 optimize status OK
196 delete from t1 where a = 1;
201 Table Op Msg_type Msg_text
202 test.t1 check status OK
204 create table t1 (a int,b varchar(20)) engine=innodb;
205 insert into t1 values (1,""), (2,"testing");
206 delete from t1 where a = 1;
210 create index skr on t1 (a);
211 insert into t1 values (3,""), (4,"testing");
213 Table Op Msg_type Msg_text
214 test.t1 analyze status OK
216 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
217 t1 1 skr 1 a A # NULL NULL YES BTREE
219 create table t1 (a int,b varchar(20),key(a)) engine=innodb;
220 insert into t1 values (1,""), (2,"testing");
221 select * from t1 where a = 1;
225 create table t1 (n int not null primary key) engine=innodb;
227 insert into t1 values (4);
229 select n, "after rollback" from t1;
231 insert into t1 values (4);
233 select n, "after commit" from t1;
237 insert into t1 values (5);
238 insert into t1 values (4);
239 ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
241 select n, "after commit" from t1;
246 insert into t1 values (6);
247 insert into t1 values (4);
248 ERROR 23000: Duplicate entry '4' for key 'PRIMARY'
256 savepoint `my_savepoint`;
257 insert into t1 values (7);
259 insert into t1 values (3);
268 rollback to savepoint savept2;
269 rollback to savepoint savept3;
270 ERROR 42000: SAVEPOINT savept3 does not exist
271 rollback to savepoint savept2;
272 release savepoint `my_savepoint`;
279 rollback to savepoint `my_savepoint`;
280 ERROR 42000: SAVEPOINT my_savepoint does not exist
281 rollback to savepoint savept2;
282 ERROR 42000: SAVEPOINT savept2 does not exist
283 insert into t1 values (8);
290 create table t1 (n int not null primary key) engine=innodb;
292 insert into t1 values (4);
293 flush tables with read lock;
301 create table t1 ( id int NOT NULL PRIMARY KEY, nom varchar(64)) engine=innodb;
303 insert into t1 values(1,'hamdouni');
304 select id as afterbegin_id,nom as afterbegin_nom from t1;
305 afterbegin_id afterbegin_nom
308 select id as afterrollback_id,nom as afterrollback_nom from t1;
309 afterrollback_id afterrollback_nom
311 insert into t1 values(2,'mysql');
312 select id as afterautocommit0_id,nom as afterautocommit0_nom from t1;
313 afterautocommit0_id afterautocommit0_nom
316 select id as afterrollback_id,nom as afterrollback_nom from t1;
317 afterrollback_id afterrollback_nom
320 CREATE TABLE t1 (id char(8) not null primary key, val int not null) engine=innodb;
321 insert into t1 values ('pippo', 12);
322 insert into t1 values ('pippo', 12);
323 ERROR 23000: Duplicate entry 'pippo' for key 'PRIMARY'
325 delete from t1 where id = 'pippo';
328 insert into t1 values ('pippo', 12);
340 create table t1 (a integer) engine=innodb;
342 rename table t1 to t2;
343 create table t1 (b integer) engine=innodb;
344 insert into t1 values (1);
347 rename table t2 to t1;
350 CREATE TABLE t1 (ID INTEGER NOT NULL PRIMARY KEY, NAME VARCHAR(64)) ENGINE=innodb;
351 INSERT INTO t1 VALUES (1, 'Jochen');
356 CREATE TABLE t1 ( _userid VARCHAR(60) NOT NULL PRIMARY KEY) ENGINE=innodb;
358 INSERT INTO t1 SET _userid='marc@anyware.co.uk';
363 SELECT _userid FROM t1 WHERE _userid='marc@anyware.co.uk';
369 user_id int(10) DEFAULT '0' NOT NULL,
372 ref_email varchar(100) DEFAULT '' NOT NULL,
374 PRIMARY KEY (user_id,ref_email)
376 INSERT INTO t1 VALUES (10292,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10292,'shirish','2333604','shirish@yahoo.com','ddsds'),(10292,'sonali','323232','sonali@bolly.com','filmstar');
377 select * from t1 where user_id=10292;
378 user_id name phone ref_email detail
379 10292 sanjeev 29153373 sansh777@hotmail.com xxx
380 10292 shirish 2333604 shirish@yahoo.com ddsds
381 10292 sonali 323232 sonali@bolly.com filmstar
382 INSERT INTO t1 VALUES (10291,'sanjeev','29153373','sansh777@hotmail.com','xxx'),(10293,'shirish','2333604','shirish@yahoo.com','ddsds');
383 select * from t1 where user_id=10292;
384 user_id name phone ref_email detail
385 10292 sanjeev 29153373 sansh777@hotmail.com xxx
386 10292 shirish 2333604 shirish@yahoo.com ddsds
387 10292 sonali 323232 sonali@bolly.com filmstar
388 select * from t1 where user_id>=10292;
389 user_id name phone ref_email detail
390 10292 sanjeev 29153373 sansh777@hotmail.com xxx
391 10292 shirish 2333604 shirish@yahoo.com ddsds
392 10292 sonali 323232 sonali@bolly.com filmstar
393 10293 shirish 2333604 shirish@yahoo.com ddsds
394 select * from t1 where user_id>10292;
395 user_id name phone ref_email detail
396 10293 shirish 2333604 shirish@yahoo.com ddsds
397 select * from t1 where user_id<10292;
398 user_id name phone ref_email detail
399 10291 sanjeev 29153373 sansh777@hotmail.com xxx
401 CREATE TABLE t1 (a int not null, b int not null,c int not null,
402 key(a),primary key(a,b), unique(c),key(a),unique(b));
404 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
405 t1 0 PRIMARY 1 a A # NULL NULL BTREE
406 t1 0 PRIMARY 2 b A # NULL NULL BTREE
407 t1 0 c 1 c A # NULL NULL BTREE
408 t1 0 b 1 b A # NULL NULL BTREE
409 t1 1 a 1 a A # NULL NULL BTREE
410 t1 1 a_2 1 a A # NULL NULL BTREE
412 create table t1 (col1 int not null, col2 char(4) not null, primary key(col1));
413 alter table t1 engine=innodb;
414 insert into t1 values ('1','1'),('5','2'),('2','3'),('3','4'),('4','4');
422 update t1 set col2='7' where col1='4';
430 alter table t1 add co3 int not null;
438 update t1 set col2='9' where col1='2';
447 create table t1 (a int not null , b int, primary key (a)) engine = innodb;
448 create table t2 (a int not null , b int, primary key (a)) engine = myisam;
449 insert into t1 VALUES (1,3) , (2,3), (3,3);
455 insert into t2 select * from t1;
461 delete from t1 where b = 3;
464 insert into t1 select * from t2;
477 user_name varchar(12),
480 user_id int(11) DEFAULT '0' NOT NULL,
486 dummy_primary_key int(11) NOT NULL auto_increment,
487 PRIMARY KEY (dummy_primary_key)
489 INSERT INTO t1 VALUES ('user_0','somepassword','N',0,0,0,'2000-09-07','23:06:59','2000-09-07 23:06:59',1);
490 INSERT INTO t1 VALUES ('user_1','somepassword','Y',1,1,1,'2000-09-07','23:06:59','2000-09-07 23:06:59',2);
491 INSERT INTO t1 VALUES ('user_2','somepassword','N',2,2,1.4142135623731,'2000-09-07','23:06:59','2000-09-07 23:06:59',3);
492 INSERT INTO t1 VALUES ('user_3','somepassword','Y',3,3,1.7320508075689,'2000-09-07','23:06:59','2000-09-07 23:06:59',4);
493 INSERT INTO t1 VALUES ('user_4','somepassword','N',4,4,2,'2000-09-07','23:06:59','2000-09-07 23:06:59',5);
494 select user_name, password , subscribed, user_id, quota, weight, access_date, access_time, approved, dummy_primary_key from t1 order by user_name;
495 user_name password subscribed user_id quota weight access_date access_time approved dummy_primary_key
496 user_0 somepassword N 0 0 0 2000-09-07 23:06:59 2000-09-07 23:06:59 1
497 user_1 somepassword Y 1 1 1 2000-09-07 23:06:59 2000-09-07 23:06:59 2
498 user_2 somepassword N 2 2 1.4142135623731 2000-09-07 23:06:59 2000-09-07 23:06:59 3
499 user_3 somepassword Y 3 3 1.7320508075689 2000-09-07 23:06:59 2000-09-07 23:06:59 4
500 user_4 somepassword N 4 4 2 2000-09-07 23:06:59 2000-09-07 23:06:59 5
503 id int(11) NOT NULL auto_increment,
504 parent_id int(11) DEFAULT '0' NOT NULL,
505 level tinyint(4) DEFAULT '0' NOT NULL,
507 KEY parent_id (parent_id),
510 INSERT INTO t1 VALUES (1,0,0),(3,1,1),(4,1,1),(8,2,2),(9,2,2),(17,3,2),(22,4,2),(24,4,2),(28,5,2),(29,5,2),(30,5,2),(31,6,2),(32,6,2),(33,6,2),(203,7,2),(202,7,2),(20,3,2),(157,0,0),(193,5,2),(40,7,2),(2,1,1),(15,2,2),(6,1,1),(34,6,2),(35,6,2),(16,3,2),(7,1,1),(36,7,2),(18,3,2),(26,5,2),(27,5,2),(183,4,2),(38,7,2),(25,5,2),(37,7,2),(21,4,2),(19,3,2),(5,1,1);
511 INSERT INTO t1 values (179,5,2);
512 update t1 set parent_id=parent_id+100;
513 select * from t1 where parent_id=102;
518 update t1 set id=id+1000;
519 update t1 set id=1024 where id=1009;
561 update ignore t1 set id=id+1;
603 update ignore t1 set id=1023 where id=1010;
604 select * from t1 where parent_id=102;
609 explain select level from t1 where level=1;
610 id select_type table type possible_keys key key_len ref rows Extra
611 1 SIMPLE t1 ref level level 1 const # Using index
612 select level,id from t1 where level=1;
620 select level,id,parent_id from t1 where level=1;
628 select level,id from t1 where level=1 order by id;
636 delete from t1 where level=1;
674 sca_code char(6) NOT NULL,
675 cat_code char(6) NOT NULL,
676 sca_desc varchar(50),
677 lan_code char(2) NOT NULL,
678 sca_pic varchar(100),
679 sca_sdesc varchar(50),
680 sca_sch_desc varchar(16),
681 PRIMARY KEY (sca_code, cat_code, lan_code),
682 INDEX sca_pic (sca_pic)
684 INSERT INTO t1 ( sca_code, cat_code, sca_desc, lan_code, sca_pic, sca_sdesc, sca_sch_desc) VALUES ( 'PD', 'J', 'PENDANT', 'EN', NULL, NULL, 'PENDANT'),( 'RI', 'J', 'RING', 'EN', NULL, NULL, 'RING'),( 'QQ', 'N', 'RING', 'EN', 'not null', NULL, 'RING');
685 select count(*) from t1 where sca_code = 'PD';
688 select count(*) from t1 where sca_code <= 'PD';
691 select count(*) from t1 where sca_pic is null;
694 alter table t1 drop index sca_pic, add index sca_pic (cat_code, sca_pic);
695 select count(*) from t1 where sca_code='PD' and sca_pic is null;
698 select count(*) from t1 where cat_code='E';
701 alter table t1 drop index sca_pic, add index (sca_pic, cat_code);
702 select count(*) from t1 where sca_code='PD' and sca_pic is null;
705 select count(*) from t1 where sca_pic >= 'n';
708 select sca_pic from t1 where sca_pic is null;
712 update t1 set sca_pic="test" where sca_pic is null;
713 delete from t1 where sca_code='pd';
716 CREATE TABLE t1 (a int not null, b timestamp not null, primary key (a)) engine=innodb;
717 insert into t1 (a) values(1),(2),(3);
718 select t1.a from t1 natural join t1 as t2 where t1.b >= @a order by t1.a;
723 select a from t1 natural join t1 as t2 where b >= @a order by a;
728 update t1 set a=5 where a=1;
735 create table t1 (a varchar(100) not null, primary key(a), b int not null) engine=innodb;
736 insert into t1 values("hello",1),("world",2);
737 select * from t1 order by b desc;
742 Table Op Msg_type Msg_text
743 test.t1 optimize note Table does not support optimize, doing recreate + analyze instead
744 test.t1 optimize status OK
746 Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
747 t1 0 PRIMARY 1 a A # NULL NULL BTREE
749 create table t1 (i int, j int ) ENGINE=innodb;
750 insert into t1 values (1,2);
751 select * from t1 where i=1 and j=2;
754 create index ax1 on t1 (i,j);
755 select * from t1 where i=1 and j=2;
760 a int3 unsigned NOT NULL,
761 b int1 unsigned NOT NULL,
764 INSERT INTO t1 VALUES (1, 1);
765 SELECT MIN(B),MAX(b) FROM t1 WHERE t1.a = 1;
769 CREATE TABLE t1 (a int unsigned NOT NULL) engine=innodb;
770 INSERT INTO t1 VALUES (1);
775 create table t1 (a int primary key,b int, c int, d int, e int, f int, g int, h int, i int, j int, k int, l int, m int, n int, o int, p int, q int, r int, s int, t int, u int, v int, w int, x int, y int, z int, a1 int, a2 int, a3 int, a4 int, a5 int, a6 int, a7 int, a8 int, a9 int, b1 int, b2 int, b3 int, b4 int, b5 int, b6 int) engine = innodb;
776 insert into t1 values (1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
777 explain select * from t1 where a > 0 and a < 50;
778 id select_type table type possible_keys key key_len ref rows Extra
779 1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL # Using where
781 create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb;
782 insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
783 LOCK TABLES t1 WRITE;
784 insert into t1 values (99,1,2,'D'),(1,1,2,'D');
785 ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY'
798 create table t1 (id int NOT NULL,id2 int NOT NULL,id3 int NOT NULL,dummy1 char(30),primary key (id,id2),index index_id3 (id3)) engine=innodb;
799 insert into t1 values (0,0,0,'ABCDEFGHIJ'),(2,2,2,'BCDEFGHIJK'),(1,1,1,'CDEFGHIJKL');
800 LOCK TABLES t1 WRITE;
802 insert into t1 values (99,1,2,'D'),(1,1,2,'D');
803 ERROR 23000: Duplicate entry '1-1' for key 'PRIMARY'
809 insert ignore into t1 values (100,1,2,'D'),(1,1,99,'D');
811 select id,id3 from t1;
819 create table t1 (a char(20), unique (a(5))) engine=innodb;
821 create table t1 (a char(20), index (a(5))) engine=innodb;
822 show create table t1;
824 t1 CREATE TABLE `t1` (
825 `a` char(20) DEFAULT NULL,
827 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
829 create temporary table t1 (a int not null auto_increment, primary key(a)) engine=innodb;
830 insert into t1 values (NULL),(NULL),(NULL);
831 delete from t1 where a=3;
832 insert into t1 values (NULL);
838 alter table t1 add b int;
847 id int auto_increment primary key,
848 name varchar(32) not null,
853 insert into t1 values (1,'one','one value',101),
854 (2,'two','two value',102),(3,'three','three value',103);
856 replace into t1 (value,name,uid) values ('other value','two',102);
857 delete from t1 where uid=102;
859 replace into t1 (value,name,uid) values ('other value','two',102);
861 replace into t1 (value,name,uid) values ('other value','two',102);
865 3 three three value 103
866 6 two other value 102
868 create database mysqltest;
869 create table mysqltest.t1 (a int not null) engine= innodb;
870 insert into mysqltest.t1 values(1);
871 create table mysqltest.t2 (a int not null) engine= myisam;
872 insert into mysqltest.t2 values(1);
873 create table mysqltest.t3 (a int not null) engine= heap;
874 insert into mysqltest.t3 values(1);
876 drop database mysqltest;
877 show tables from mysqltest;
878 ERROR 42000: Unknown database 'mysqltest'
880 create table t1 (a int not null) engine= innodb;
881 insert into t1 values(1),(2);
888 insert into t1 values(1),(2);
895 create table t1 (a int not null) engine= innodb;
896 insert into t1 values(1),(2);
898 insert into t1 values(1),(2);
904 insert into t1 values(1),(2);
909 create table t1 (a int not null, b int not null, c int not null, primary key (a),key(b)) engine=innodb;
910 insert into t1 values (3,3,3),(1,1,1),(2,2,2),(4,4,4);
911 explain select * from t1 order by a;
912 id select_type table type possible_keys key key_len ref rows Extra
913 1 SIMPLE t1 index NULL PRIMARY 4 NULL #
914 explain select * from t1 order by b;
915 id select_type table type possible_keys key key_len ref rows Extra
916 1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort
917 explain select * from t1 order by c;
918 id select_type table type possible_keys key key_len ref rows Extra
919 1 SIMPLE t1 ALL NULL NULL NULL NULL # Using filesort
920 explain select a from t1 order by a;
921 id select_type table type possible_keys key key_len ref rows Extra
922 1 SIMPLE t1 index NULL PRIMARY 4 NULL # Using index
923 explain select b from t1 order by b;
924 id select_type table type possible_keys key key_len ref rows Extra
925 1 SIMPLE t1 index NULL b 4 NULL # Using index
926 explain select a,b from t1 order by b;
927 id select_type table type possible_keys key key_len ref rows Extra
928 1 SIMPLE t1 index NULL b 4 NULL # Using index
929 explain select a,b from t1;
930 id select_type table type possible_keys key key_len ref rows Extra
931 1 SIMPLE t1 index NULL b 4 NULL # Using index
932 explain select a,b,c from t1;
933 id select_type table type possible_keys key key_len ref rows Extra
934 1 SIMPLE t1 ALL NULL NULL NULL NULL #
936 create table t1 (t int not null default 1, key (t)) engine=innodb;
938 Field Type Null Key Default Extra
942 number bigint(20) NOT NULL default '0',
943 cname char(15) NOT NULL default '',
944 carrier_id smallint(6) NOT NULL default '0',
945 privacy tinyint(4) NOT NULL default '0',
946 last_mod_date timestamp NOT NULL,
947 last_mod_id smallint(6) NOT NULL default '0',
948 last_app_date timestamp NOT NULL,
949 last_app_id smallint(6) default '-1',
950 version smallint(6) NOT NULL default '0',
951 assigned_scps int(11) default '0',
952 status tinyint(4) default '0'
954 INSERT INTO t1 VALUES (4077711111,'SeanWheeler',90,2,20020111112846,500,00000000000000,-1,2,3,1);
955 INSERT INTO t1 VALUES (9197722223,'berry',90,3,20020111112809,500,20020102114532,501,4,10,0);
956 INSERT INTO t1 VALUES (650,'San Francisco',0,0,20011227111336,342,00000000000000,-1,1,24,1);
957 INSERT INTO t1 VALUES (302467,'Sue\'s Subshop',90,3,20020109113241,500,20020102115111,501,7,24,0);
958 INSERT INTO t1 VALUES (6014911113,'SudzCarwash',520,1,20020102115234,500,20020102115259,501,33,32768,0);
959 INSERT INTO t1 VALUES (333,'tubs',99,2,20020109113440,501,20020109113440,500,3,10,0);
961 number bigint(20) NOT NULL default '0',
962 cname char(15) NOT NULL default '',
963 carrier_id smallint(6) NOT NULL default '0',
964 privacy tinyint(4) NOT NULL default '0',
965 last_mod_date timestamp NOT NULL,
966 last_mod_id smallint(6) NOT NULL default '0',
967 last_app_date timestamp NOT NULL,
968 last_app_id smallint(6) default '-1',
969 version smallint(6) NOT NULL default '0',
970 assigned_scps int(11) default '0',
971 status tinyint(4) default '0'
973 INSERT INTO t2 VALUES (4077711111,'SeanWheeler',0,2,20020111112853,500,00000000000000,-1,2,3,1);
974 INSERT INTO t2 VALUES (9197722223,'berry',90,3,20020111112818,500,20020102114532,501,4,10,0);
975 INSERT INTO t2 VALUES (650,'San Francisco',90,0,20020109113158,342,00000000000000,-1,1,24,1);
976 INSERT INTO t2 VALUES (333,'tubs',99,2,20020109113453,501,20020109113453,500,3,10,0);
978 number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
979 4077711111 SeanWheeler 90 2 2002-01-11 11:28:46 500 0000-00-00 00:00:00 -1 2 3 1
980 9197722223 berry 90 3 2002-01-11 11:28:09 500 2002-01-02 11:45:32 501 4 10 0
981 650 San Francisco 0 0 2001-12-27 11:13:36 342 0000-00-00 00:00:00 -1 1 24 1
982 302467 Sue's Subshop 90 3 2002-01-09 11:32:41 500 2002-01-02 11:51:11 501 7 24 0
983 6014911113 SudzCarwash 520 1 2002-01-02 11:52:34 500 2002-01-02 11:52:59 501 33 32768 0
984 333 tubs 99 2 2002-01-09 11:34:40 501 2002-01-09 11:34:40 500 3 10 0
986 number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
987 4077711111 SeanWheeler 0 2 2002-01-11 11:28:53 500 0000-00-00 00:00:00 -1 2 3 1
988 9197722223 berry 90 3 2002-01-11 11:28:18 500 2002-01-02 11:45:32 501 4 10 0
989 650 San Francisco 90 0 2002-01-09 11:31:58 342 0000-00-00 00:00:00 -1 1 24 1
990 333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0
991 delete t1, t2 from t1 left join t2 on t1.number=t2.number where (t1.carrier_id=90 and t1.number=t2.number) or (t2.carrier_id=90 and t1.number=t2.number) or (t1.carrier_id=90 and t2.number is null);
993 number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
994 6014911113 SudzCarwash 520 1 2002-01-02 11:52:34 500 2002-01-02 11:52:59 501 33 32768 0
995 333 tubs 99 2 2002-01-09 11:34:40 501 2002-01-09 11:34:40 500 3 10 0
997 number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
998 333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0
1000 number cname carrier_id privacy last_mod_date last_mod_id last_app_date last_app_id version assigned_scps status
1001 333 tubs 99 2 2002-01-09 11:34:53 501 2002-01-09 11:34:53 500 3 10 0
1003 create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb;
1005 SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE;
1006 SELECT @@tx_isolation,@@global.tx_isolation;
1007 @@tx_isolation @@global.tx_isolation
1008 SERIALIZABLE REPEATABLE-READ
1009 insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David');
1010 select id, code, name from t1 order by id;
1017 SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
1018 insert into t1 (code, name) values (2, 'Erik'), (3, 'Sasha');
1019 select id, code, name from t1 order by id;
1027 SET binlog_format='MIXED';
1029 SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
1030 insert into t1 (code, name) values (3, 'Jeremy'), (4, 'Matt');
1031 select id, code, name from t1 order by id;
1042 create table t1 (n int(10), d int(10)) engine=innodb;
1043 create table t2 (n int(10), d int(10)) engine=innodb;
1044 insert into t1 values(1,1),(1,2);
1045 insert into t2 values(1,10),(2,20);
1046 UPDATE t1,t2 SET t1.d=t2.d,t2.d=30 WHERE t1.n=t2.n;
1056 drop table if exists t1, t2;
1057 CREATE TABLE t1 (a int, PRIMARY KEY (a));
1058 CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
1059 create trigger trg_del_t2 after delete on t2 for each row
1060 insert into t1 values (1);
1061 insert into t1 values (1);
1062 insert into t2 values (1),(2);
1064 ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
1065 select count(*) from t2 /* must be 2 as restored after rollback caused by the error */;
1069 drop table if exists t1, t2;
1070 CREATE TABLE t1 (a int, PRIMARY KEY (a));
1071 CREATE TABLE t2 (a int, PRIMARY KEY (a)) ENGINE=InnoDB;
1072 create trigger trg_del_t2 after delete on t2 for each row
1073 insert into t1 values (1);
1074 insert into t1 values (1);
1075 insert into t2 values (1),(2);
1077 ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
1078 select count(*) from t2 /* must be 2 as restored after rollback caused by the error */;
1082 create table t1 (a int, b int) engine=innodb;
1083 insert into t1 values(20,null);
1084 select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
1086 b ifnull(t2.b,"this is null")
1088 select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
1089 t2.b=t3.a order by 1;
1090 b ifnull(t2.b,"this is null")
1092 insert into t1 values(10,null);
1093 select t2.b, ifnull(t2.b,"this is null") from t1 as t2 left join t1 as t3 on
1094 t2.b=t3.a order by 1;
1095 b ifnull(t2.b,"this is null")
1099 create table t1 (a varchar(10) not null) engine=myisam;
1100 create table t2 (b varchar(10) not null unique) engine=innodb;
1101 select t1.a from t1,t2 where t1.a=t2.b;
1104 create table t1 (a int not null, b int, primary key (a)) engine = innodb;
1105 create table t2 (a int not null, b int, primary key (a)) engine = innodb;
1106 insert into t1 values (10, 20);
1107 insert into t2 values (10, 20);
1108 update t1, t2 set t1.b = 150, t2.b = t1.b where t2.a = t1.a and t1.a = 10;
1110 CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
1111 CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE ) ENGINE=INNODB;
1112 insert into t1 set id=1;
1113 insert into t2 set id=1, t1_id=1;
1114 delete t1,t2 from t1,t2 where t1.id=t2.t1_id;
1120 CREATE TABLE t1(id INT NOT NULL, PRIMARY KEY (id)) ENGINE=INNODB;
1121 CREATE TABLE t2(id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id) ) ENGINE=INNODB;
1122 INSERT INTO t1 VALUES(1);
1123 INSERT INTO t2 VALUES(1, 1);
1127 UPDATE t1,t2 SET t1.id=t1.id+1, t2.t1_id=t1.id+1;
1131 UPDATE t1,t2 SET t1.id=t1.id+1 where t1.id!=t2.id;
1137 CREATE TABLE t1 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
1138 CREATE TABLE t2 (id CHAR(15) NOT NULL, value CHAR(40) NOT NULL, PRIMARY KEY(id)) ENGINE=InnoDB;
1139 CREATE TABLE t3 (id1 CHAR(15) NOT NULL, id2 CHAR(15) NOT NULL, PRIMARY KEY(id1, id2)) ENGINE=InnoDB;
1140 INSERT INTO t3 VALUES("my-test-1", "my-test-2");
1142 INSERT INTO t1 VALUES("this-key", "will disappear");
1143 INSERT INTO t2 VALUES("this-key", "will also disappear");
1144 DELETE FROM t3 WHERE id1="my-test-1";
1147 this-key will disappear
1150 this-key will also disappear
1161 SELECT * FROM t3 WHERE id1="my-test-1" LOCK IN SHARE MODE;
1166 DROP TABLE t1,t2,t3;
1167 CREATE TABLE t1 (a int not null primary key, b int not null, unique (b)) engine=innodb;
1168 INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
1169 UPDATE t1 set a=a+100 where b between 2 and 3 and a < 1000;
1182 CREATE TABLE t2 ( NEXT_T BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM;
1183 CREATE TABLE t1 ( B_ID INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
1185 INSERT INTO t1 ( B_ID ) VALUES ( 1 );
1186 INSERT INTO t2 ( NEXT_T ) VALUES ( 1 );
1189 Warning 1196 Some non-transactional changed tables couldn't be rolled back
1193 create table t1 ( pk int primary key, parent int not null, child int not null, index (parent) ) engine = innodb;
1194 insert into t1 values (1,0,4), (2,1,3), (3,2,1), (4,1,2);
1195 select distinct parent,child from t1 order by parent;
1202 create table t1 (a int not null auto_increment primary key, b int, c int, key(c)) engine=innodb;
1203 create table t2 (a int not null auto_increment primary key, b int);
1204 insert into t1 (b) values (null),(null),(null),(null),(null),(null),(null);
1205 insert into t2 (a) select b from t1;
1206 insert into t1 (b) select b from t2;
1207 insert into t2 (a) select b from t1;
1208 insert into t1 (a) select b from t2;
1209 insert into t2 (a) select b from t1;
1210 insert into t1 (a) select b from t2;
1211 insert into t2 (a) select b from t1;
1212 insert into t1 (a) select b from t2;
1213 insert into t2 (a) select b from t1;
1214 insert into t1 (a) select b from t2;
1215 select count(*) from t1;
1218 explain select * from t1 where c between 1 and 2500;
1219 id select_type table type possible_keys key key_len ref rows Extra
1220 1 SIMPLE t1 range c c 5 NULL # Using where
1222 explain select * from t1 where c between 1 and 2500;
1223 id select_type table type possible_keys key key_len ref rows Extra
1224 1 SIMPLE t1 ALL c NULL NULL NULL # Using where
1226 create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=innodb;
1227 insert into t1 (id) values (null),(null),(null),(null),(null);
1228 update t1 set fk=69 where fk is null order by id limit 1;
1237 create table t1 (a int not null, b int not null, key (a));
1238 insert into t1 values (1,1),(1,2),(1,3),(3,1),(3,2),(3,3),(3,1),(3,2),(3,3),(2,1),(2,2),(2,3);
1240 update t1 set b=(@tmp:=@tmp+1) order by a;
1241 update t1 set b=99 where a=1 order by b asc limit 1;
1242 update t1 set b=100 where a=1 order by b desc limit 2;
1243 update t1 set a=a+10+b where a=1 order by b;
1244 select * from t1 order by a,b;
1259 create table t1 ( c char(8) not null ) engine=innodb;
1260 insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
1261 insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
1262 alter table t1 add b char(8) not null;
1263 alter table t1 add a char(8) not null;
1264 alter table t1 add primary key (a,b,c);
1265 update t1 set a=c, b=c;
1266 create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) engine=innodb;
1267 insert into t2 select * from t1;
1268 delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
1271 create table t1 (a integer auto_increment primary key) engine=innodb;
1272 insert into t1 (a) values (NULL),(NULL);
1274 insert into t1 (a) values (NULL),(NULL);
1280 CREATE TABLE t1 (`id 1` INT NOT NULL, PRIMARY KEY (`id 1`)) ENGINE=INNODB;
1281 CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (`t1_id`) REFERENCES `t1`(`id 1`) ON DELETE CASCADE ) ENGINE=INNODB;
1283 create table `t1` (`id` int( 11 ) not null ,primary key ( `id` )) engine = innodb;
1284 insert into `t1`values ( 1 ) ;
1285 create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` ) ,constraint `t1_id_fk` foreign key ( `id` ) references `t1` (`id` )) engine = innodb;
1286 insert into `t2`values ( 1 ) ;
1287 create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = innodb;
1288 insert into `t3`values ( 1 ) ;
1289 delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
1290 ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
1291 update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
1292 ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t2`, CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`))
1293 update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id;
1294 ERROR 42S22: Unknown column 't1.id' in 'where clause'
1295 drop table t3,t2,t1;
1297 c1 VARCHAR(8), c2 VARCHAR(8),
1298 PRIMARY KEY (c1, c2)
1302 c1 VARCHAR(8) UNIQUE,
1303 FOREIGN KEY (c1) REFERENCES t1 (c1) ON UPDATE CASCADE
1305 INSERT INTO t1 VALUES ('old', 'somevalu'), ('other', 'anyvalue');
1306 INSERT INTO t2 VALUES (10, 'old'), (20, 'other');
1307 UPDATE t1 SET c1 = 'other' WHERE c1 = 'old';
1308 ERROR 23000: Upholding foreign key constraints for table 't1', entry 'other-somevalu', key 2 would lead to a duplicate entry
1314 foreign key(pid) references t1(id) on delete cascade) engine=innodb;
1315 insert into t1 values(0,0),(1,0),(2,1),(3,2),(4,3),(5,4),(6,5),(7,6),
1316 (8,7),(9,8),(10,9),(11,10),(12,11),(13,12),(14,13),(15,14);
1317 delete from t1 where id=0;
1318 ERROR 23000: Cannot delete or update a parent row: a foreign key constraint fails (`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`pid`) REFERENCES `t1` (`id`) ON DELETE CASCADE)
1319 delete from t1 where id=15;
1320 delete from t1 where id=0;
1322 CREATE TABLE t1 (col1 int(1))ENGINE=InnoDB;
1323 CREATE TABLE t2 (col1 int(1),stamp TIMESTAMP,INDEX stamp_idx
1324 (stamp))ENGINE=InnoDB;
1325 insert into t1 values (1),(2),(3);
1326 insert into t2 values (1, 20020204130000),(2, 20020204130000),(4,20020204310000 ),(5,20020204230000);
1328 Warning 1265 Data truncated for column 'stamp' at row 3
1329 SELECT col1 FROM t1 UNION SELECT col1 FROM t2 WHERE stamp <
1330 '20020204120000' GROUP BY col1;
1338 `id` int(10) unsigned NOT NULL auto_increment,
1339 `id_object` int(10) unsigned default '0',
1340 `id_version` int(10) unsigned NOT NULL default '1',
1341 `label` varchar(100) NOT NULL default '',
1344 KEY `id_object` (`id_object`),
1345 KEY `id_version` (`id_version`)
1347 INSERT INTO t1 VALUES("6", "3382", "9", "Test", NULL), ("7", "102", "5", "Le Pekin (Test)", NULL),("584", "1794", "4", "Test de resto", NULL),("837", "1822", "6", "Test 3", NULL),("1119", "3524", "1", "Societe Test", NULL),("1122", "3525", "1", "Fournisseur Test", NULL);
1349 `id` int(10) unsigned NOT NULL auto_increment,
1350 `id_version` int(10) unsigned NOT NULL default '1',
1352 KEY `id_version` (`id_version`)
1354 INSERT INTO t2 VALUES("3524", "1"),("3525", "1"),("1794", "4"),("102", "5"),("1822", "6"),("3382", "9");
1355 SELECT t2.id, t1.`label` FROM t2 INNER JOIN
1356 (SELECT t1.id_object as id_object FROM t1 WHERE t1.`label` LIKE '%test%') AS lbl
1357 ON (t2.id = lbl.id_object) INNER JOIN t1 ON (t2.id = t1.id_object);
1364 3525 Fournisseur Test
1366 create table t1 (a int, b varchar(200), c text not null) checksum=1 engine=myisam;
1367 create table t2 (a int, b varchar(200), c text not null) checksum=0 engine=innodb;
1368 create table t3 (a int, b varchar(200), c text not null) checksum=1 engine=innodb;
1369 insert t1 values (1, "aaa", "bbb"), (NULL, "", "ccccc"), (0, NULL, "");
1370 insert t2 select * from t1;
1371 insert t3 select * from t1;
1372 checksum table t1, t2, t3, t4 quick;
1379 Error 1146 Table 'test.t4' doesn't exist
1380 checksum table t1, t2, t3, t4;
1387 Error 1146 Table 'test.t4' doesn't exist
1388 checksum table t1, t2, t3, t4 extended;
1395 Error 1146 Table 'test.t4' doesn't exist
1396 drop table t1,t2,t3;
1397 create table t1 (id int, name char(10) not null, name2 char(10) not null) engine=innodb;
1398 insert into t1 values(1,'first','fff'),(2,'second','sss'),(3,'third','ttt');
1399 select trim(name2) from t1 union all select trim(name) from t1 union all select trim(id) from t1;
1411 create table t1 (a int) engine=innodb;
1412 create table t2 like t1;
1414 create table t1 (id int(11) not null, id2 int(11) not null, unique (id,id2)) engine=innodb;
1415 create table t2 (id int(11) not null, constraint t1_id_fk foreign key ( id ) references t1 (id)) engine = innodb;
1416 show create table t1;
1418 t1 CREATE TABLE `t1` (
1419 `id` int(11) NOT NULL,
1420 `id2` int(11) NOT NULL,
1421 UNIQUE KEY `id` (`id`,`id2`)
1422 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
1423 show create table t2;
1425 t2 CREATE TABLE `t2` (
1426 `id` int(11) NOT NULL,
1427 KEY `t1_id_fk` (`id`),
1428 CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
1429 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
1430 create index id on t2 (id);
1431 show create table t2;
1433 t2 CREATE TABLE `t2` (
1434 `id` int(11) NOT NULL,
1436 CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
1437 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
1438 create index id2 on t2 (id);
1439 show create table t2;
1441 t2 CREATE TABLE `t2` (
1442 `id` int(11) NOT NULL,
1445 CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
1446 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
1447 drop index id2 on t2;
1448 drop index id on t2;
1449 Got one of the listed errors
1450 show create table t2;
1452 t2 CREATE TABLE `t2` (
1453 `id` int(11) NOT NULL,
1455 CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
1456 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
1458 create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id,id2) references t1 (id,id2)) engine = innodb;
1459 show create table t2;
1461 t2 CREATE TABLE `t2` (
1462 `id` int(11) NOT NULL,
1463 `id2` int(11) NOT NULL,
1464 KEY `t1_id_fk` (`id`,`id2`),
1465 CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
1466 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
1467 create unique index id on t2 (id,id2);
1468 show create table t2;
1470 t2 CREATE TABLE `t2` (
1471 `id` int(11) NOT NULL,
1472 `id2` int(11) NOT NULL,
1473 UNIQUE KEY `id` (`id`,`id2`),
1474 CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`, `id2`) REFERENCES `t1` (`id`, `id2`)
1475 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
1477 create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
1478 show create table t2;
1480 t2 CREATE TABLE `t2` (
1481 `id` int(11) NOT NULL,
1482 `id2` int(11) NOT NULL,
1483 UNIQUE KEY `id` (`id`,`id2`),
1484 KEY `t1_id_fk` (`id2`,`id`),
1485 CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
1486 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
1488 create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2), constraint t1_id_fk foreign key (id) references t1 (id)) engine = innodb;
1489 show create table t2;
1491 t2 CREATE TABLE `t2` (
1492 `id` int(11) NOT NULL,
1493 `id2` int(11) NOT NULL,
1494 UNIQUE KEY `id` (`id`,`id2`),
1495 CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
1496 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
1498 create table t2 (id int(11) not null, id2 int(11) not null, unique (id,id2),constraint t1_id_fk foreign key (id2,id) references t1 (id,id2)) engine = innodb;
1499 show create table t2;
1501 t2 CREATE TABLE `t2` (
1502 `id` int(11) NOT NULL,
1503 `id2` int(11) NOT NULL,
1504 UNIQUE KEY `id` (`id`,`id2`),
1505 KEY `t1_id_fk` (`id2`,`id`),
1506 CONSTRAINT `t1_id_fk` FOREIGN KEY (`id2`, `id`) REFERENCES `t1` (`id`, `id2`)
1507 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
1509 create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id), primary key (id), index (id,id2)) engine = innodb;
1510 show create table t2;
1512 t2 CREATE TABLE `t2` (
1513 `id` int(11) NOT NULL AUTO_INCREMENT,
1514 `id2` int(11) NOT NULL,
1516 KEY `id` (`id`,`id2`),
1517 CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
1518 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
1520 create table t2 (id int(11) not null auto_increment, id2 int(11) not null, constraint t1_id_fk foreign key (id) references t1 (id)) engine= innodb;
1521 show create table t2;
1523 t2 CREATE TABLE `t2` (
1524 `id` int(11) NOT NULL AUTO_INCREMENT,
1525 `id2` int(11) NOT NULL,
1526 KEY `t1_id_fk` (`id`),
1527 CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
1528 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
1529 alter table t2 add index id_test (id), add index id_test2 (id,id2);
1530 show create table t2;
1532 t2 CREATE TABLE `t2` (
1533 `id` int(11) NOT NULL AUTO_INCREMENT,
1534 `id2` int(11) NOT NULL,
1535 KEY `id_test` (`id`),
1536 KEY `id_test2` (`id`,`id2`),
1537 CONSTRAINT `t1_id_fk` FOREIGN KEY (`id`) REFERENCES `t1` (`id`)
1538 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
1540 create table t2 (id int(11) not null, id2 int(11) not null, constraint t1_id_fk foreign key (id2,id) references t1 (id)) engine = innodb;
1541 ERROR 42000: Incorrect foreign key definition for 't1_id_fk': Key reference and table reference don't match
1542 create table t2 (a int auto_increment primary key, b int, index(b), foreign key (b) references t1(id), unique(b)) engine=innodb;
1543 show create table t2;
1545 t2 CREATE TABLE `t2` (
1546 `a` int(11) NOT NULL AUTO_INCREMENT,
1547 `b` int(11) DEFAULT NULL,
1549 UNIQUE KEY `b_2` (`b`),
1551 CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`)
1552 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
1554 create table t2 (a int auto_increment primary key, b int, foreign key (b) references t1(id), foreign key (b) references t1(id), unique(b)) engine=innodb;
1555 show create table t2;
1557 t2 CREATE TABLE `t2` (
1558 `a` int(11) NOT NULL AUTO_INCREMENT,
1559 `b` int(11) DEFAULT NULL,
1561 UNIQUE KEY `b` (`b`),
1562 CONSTRAINT `t2_ibfk_1` FOREIGN KEY (`b`) REFERENCES `t1` (`id`),
1563 CONSTRAINT `t2_ibfk_2` FOREIGN KEY (`b`) REFERENCES `t1` (`id`)
1564 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
1566 create table t1 (c char(10), index (c,c)) engine=innodb;
1567 ERROR 42S21: Duplicate column name 'c'
1568 create table t1 (c1 char(10), c2 char(10), index (c1,c2,c1)) engine=innodb;
1569 ERROR 42S21: Duplicate column name 'c1'
1570 create table t1 (c1 char(10), c2 char(10), index (c1,c1,c2)) engine=innodb;
1571 ERROR 42S21: Duplicate column name 'c1'
1572 create table t1 (c1 char(10), c2 char(10), index (c2,c1,c1)) engine=innodb;
1573 ERROR 42S21: Duplicate column name 'c1'
1574 create table t1 (c1 char(10), c2 char(10)) engine=innodb;
1575 alter table t1 add key (c1,c1);
1576 ERROR 42S21: Duplicate column name 'c1'
1577 alter table t1 add key (c2,c1,c1);
1578 ERROR 42S21: Duplicate column name 'c1'
1579 alter table t1 add key (c1,c2,c1);
1580 ERROR 42S21: Duplicate column name 'c1'
1581 alter table t1 add key (c1,c1,c2);
1582 ERROR 42S21: Duplicate column name 'c1'
1584 create table t1(a int(1) , b int(1)) engine=innodb;
1585 insert into t1 values ('1111', '3333');
1586 select distinct concat(a, b) from t1;
1590 CREATE TABLE t1 ( a char(10) ) ENGINE=InnoDB;
1591 SELECT a FROM t1 WHERE MATCH (a) AGAINST ('test' IN BOOLEAN MODE);
1592 ERROR HY000: The used table type doesn't support FULLTEXT indexes
1594 CREATE TABLE t1 (a_id tinyint(4) NOT NULL default '0', PRIMARY KEY (a_id)) ENGINE=InnoDB DEFAULT CHARSET=latin1;
1595 INSERT INTO t1 VALUES (1),(2),(3);
1596 CREATE TABLE t2 (b_id tinyint(4) NOT NULL default '0',b_a tinyint(4) NOT NULL default '0', PRIMARY KEY (b_id), KEY (b_a),
1597 CONSTRAINT fk_b_a FOREIGN KEY (b_a) REFERENCES t1 (a_id) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE=InnoDB DEFAULT CHARSET=latin1;
1598 INSERT INTO t2 VALUES (1,1),(2,1),(3,1),(4,2),(5,2);
1599 SELECT * FROM (SELECT t1.*,GROUP_CONCAT(t2.b_id SEPARATOR ',') as b_list FROM (t1 LEFT JOIN (t2) on t1.a_id = t2.b_a) GROUP BY t1.a_id ) AS xyz;
1606 create temporary table t1 (a int) engine=innodb;
1607 insert into t1 values (4711);
1609 insert into t1 values (42);
1614 create table t1 (a int) engine=innodb;
1615 insert into t1 values (4711);
1617 insert into t1 values (42);
1622 create table t1 (a int not null, b int not null, c blob not null, d int not null, e int, primary key (a,b,c(255),d)) engine=innodb;
1623 insert into t1 values (2,2,"b",2,2),(1,1,"a",1,1),(3,3,"ab",3,3);
1624 select * from t1 order by a,b,c,d;
1629 explain select * from t1 order by a,b,c,d;
1630 id select_type table type possible_keys key key_len ref rows Extra
1631 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
1633 create table t1 (a char(1), b char(1), key(a, b)) engine=innodb;
1634 insert into t1 values ('8', '6'), ('4', '7');
1635 select min(a) from t1;
1638 select min(b) from t1 where a='8';
1642 create table t1 (x bigint unsigned not null primary key) engine=innodb;
1643 insert into t1(x) values (0xfffffffffffffff0),(0xfffffffffffffff1);
1646 18446744073709551600
1647 18446744073709551601
1648 select count(*) from t1 where x>0;
1651 select count(*) from t1 where x=0;
1654 select count(*) from t1 where x<0;
1657 select count(*) from t1 where x < -16;
1660 select count(*) from t1 where x = -16;
1663 explain select count(*) from t1 where x > -16;
1664 id select_type table type possible_keys key key_len ref rows Extra
1665 1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 2 Using where; Using index
1666 select count(*) from t1 where x > -16;
1669 select * from t1 where x > -16;
1671 18446744073709551600
1672 18446744073709551601
1673 select count(*) from t1 where x = 18446744073709551601;
1677 SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_buffer_pool_pages_total';
1680 SELECT variable_value FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_page_size';
1683 SELECT variable_value - @innodb_rows_deleted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_deleted';
1684 variable_value - @innodb_rows_deleted_orig
1686 SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted';
1687 variable_value - @innodb_rows_inserted_orig
1689 SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated';
1690 variable_value - @innodb_rows_updated_orig
1692 SELECT variable_value - @innodb_row_lock_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits';
1693 variable_value - @innodb_row_lock_waits_orig
1695 SELECT variable_value - @innodb_row_lock_current_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_current_waits';
1696 variable_value - @innodb_row_lock_current_waits_orig
1698 SELECT variable_value - @innodb_row_lock_time_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time';
1699 variable_value - @innodb_row_lock_time_orig
1701 SELECT variable_value - @innodb_row_lock_time_max_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_max';
1702 variable_value - @innodb_row_lock_time_max_orig
1704 SELECT variable_value - @innodb_row_lock_time_avg_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_time_avg';
1705 variable_value - @innodb_row_lock_time_avg_orig
1707 show variables like "innodb_sync_spin_loops";
1709 innodb_sync_spin_loops 20
1710 set global innodb_sync_spin_loops=1000;
1711 show variables like "innodb_sync_spin_loops";
1713 innodb_sync_spin_loops 1000
1714 set global innodb_sync_spin_loops=0;
1715 show variables like "innodb_sync_spin_loops";
1717 innodb_sync_spin_loops 0
1718 set global innodb_sync_spin_loops=20;
1719 show variables like "innodb_sync_spin_loops";
1721 innodb_sync_spin_loops 20
1722 SET @old_innodb_thread_concurrency= @@global.innodb_thread_concurrency;
1723 show variables like "innodb_thread_concurrency";
1725 innodb_thread_concurrency 8
1726 set global innodb_thread_concurrency=1001;
1728 Warning 1292 Truncated incorrect thread_concurrency value: '1001'
1729 show variables like "innodb_thread_concurrency";
1731 innodb_thread_concurrency 1000
1732 set global innodb_thread_concurrency=0;
1733 show variables like "innodb_thread_concurrency";
1735 innodb_thread_concurrency 0
1736 set global innodb_thread_concurrency=16;
1737 show variables like "innodb_thread_concurrency";
1739 innodb_thread_concurrency 16
1740 SET @@global.innodb_thread_concurrency= @old_innodb_thread_concurrency;
1741 show variables like "innodb_concurrency_tickets";
1743 innodb_concurrency_tickets 500
1744 set global innodb_concurrency_tickets=1000;
1745 show variables like "innodb_concurrency_tickets";
1747 innodb_concurrency_tickets 1000
1748 set global innodb_concurrency_tickets=0;
1750 Warning 1292 Truncated incorrect concurrency_tickets value: '0'
1751 show variables like "innodb_concurrency_tickets";
1753 innodb_concurrency_tickets 1
1754 set global innodb_concurrency_tickets=500;
1755 show variables like "innodb_concurrency_tickets";
1757 innodb_concurrency_tickets 500
1758 show variables like "innodb_thread_sleep_delay";
1760 innodb_thread_sleep_delay 10000
1761 set global innodb_thread_sleep_delay=100000;
1762 show variables like "innodb_thread_sleep_delay";
1764 innodb_thread_sleep_delay 100000
1765 set global innodb_thread_sleep_delay=0;
1766 show variables like "innodb_thread_sleep_delay";
1768 innodb_thread_sleep_delay 0
1769 set global innodb_thread_sleep_delay=10000;
1770 show variables like "innodb_thread_sleep_delay";
1772 innodb_thread_sleep_delay 10000
1773 set storage_engine=INNODB;
1774 drop table if exists t1,t2,t3;
1775 --- Testing varchar ---
1776 --- Testing varchar ---
1777 create table t1 (v varchar(10), c char(10), t text);
1778 insert into t1 values('+ ', '+ ', '+ ');
1779 set @a=repeat(' ',20);
1780 insert into t1 values (concat('+',@a),concat('+',@a),concat('+',@a));
1782 Note 1265 Data truncated for column 'v' at row 1
1783 select concat('*',v,'*',c,'*',t,'*') from t1;
1784 concat('*',v,'*',c,'*',t,'*')
1787 show create table t1;
1789 t1 CREATE TABLE `t1` (
1790 `v` varchar(10) DEFAULT NULL,
1791 `c` char(10) DEFAULT NULL,
1793 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
1794 create table t2 like t1;
1795 show create table t2;
1797 t2 CREATE TABLE `t2` (
1798 `v` varchar(10) DEFAULT NULL,
1799 `c` char(10) DEFAULT NULL,
1801 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
1802 create table t3 select * from t1;
1803 show create table t3;
1805 t3 CREATE TABLE `t3` (
1806 `v` varchar(10) DEFAULT NULL,
1807 `c` char(10) DEFAULT NULL,
1809 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
1810 alter table t1 modify c varchar(10);
1811 show create table t1;
1813 t1 CREATE TABLE `t1` (
1814 `v` varchar(10) DEFAULT NULL,
1815 `c` varchar(10) DEFAULT NULL,
1817 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
1818 alter table t1 modify v char(10);
1819 show create table t1;
1821 t1 CREATE TABLE `t1` (
1822 `v` char(10) DEFAULT NULL,
1823 `c` varchar(10) DEFAULT NULL,
1825 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
1826 alter table t1 modify t varchar(10);
1828 Note 1265 Data truncated for column 't' at row 2
1829 show create table t1;
1831 t1 CREATE TABLE `t1` (
1832 `v` char(10) DEFAULT NULL,
1833 `c` varchar(10) DEFAULT NULL,
1834 `t` varchar(10) DEFAULT NULL
1835 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
1836 select concat('*',v,'*',c,'*',t,'*') from t1;
1837 concat('*',v,'*',c,'*',t,'*')
1840 drop table t1,t2,t3;
1841 create table t1 (v varchar(10), c char(10), t text, key(v), key(c), key(t(10)));
1842 show create table t1;
1844 t1 CREATE TABLE `t1` (
1845 `v` varchar(10) DEFAULT NULL,
1846 `c` char(10) DEFAULT NULL,
1851 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
1852 select count(*) from t1;
1855 insert into t1 values(concat('a',char(1)),concat('a',char(1)),concat('a',char(1)));
1856 select count(*) from t1 where v='a';
1859 select count(*) from t1 where c='a';
1862 select count(*) from t1 where t='a';
1865 select count(*) from t1 where v='a ';
1868 select count(*) from t1 where c='a ';
1871 select count(*) from t1 where t='a ';
1874 select count(*) from t1 where v between 'a' and 'a ';
1877 select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
1880 select count(*) from t1 where v like 'a%';
1883 select count(*) from t1 where c like 'a%';
1886 select count(*) from t1 where t like 'a%';
1889 select count(*) from t1 where v like 'a %';
1892 explain select count(*) from t1 where v='a ';
1893 id select_type table type possible_keys key key_len ref rows Extra
1894 1 SIMPLE t1 ref v v 13 const # Using where; Using index
1895 explain select count(*) from t1 where c='a ';
1896 id select_type table type possible_keys key key_len ref rows Extra
1897 1 SIMPLE t1 ref c c 11 const # Using where; Using index
1898 explain select count(*) from t1 where t='a ';
1899 id select_type table type possible_keys key key_len ref rows Extra
1900 1 SIMPLE t1 ref t t 13 const # Using where
1901 explain select count(*) from t1 where v like 'a%';
1902 id select_type table type possible_keys key key_len ref rows Extra
1903 1 SIMPLE t1 range v v 13 NULL # Using where; Using index
1904 explain select count(*) from t1 where v between 'a' and 'a ';
1905 id select_type table type possible_keys key key_len ref rows Extra
1906 1 SIMPLE t1 ref v v 13 const # Using where; Using index
1907 explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
1908 id select_type table type possible_keys key key_len ref rows Extra
1909 1 SIMPLE t1 ref v v 13 const # Using where; Using index
1910 alter table t1 add unique(v);
1911 ERROR 23000: Duplicate entry '{ ' for key 'v_2'
1912 alter table t1 add key(v);
1913 select concat('*',v,'*',c,'*',t,'*') as qq from t1 where v='a';
1925 explain select * from t1 where v='a';
1926 id select_type table type possible_keys key key_len ref rows Extra
1927 1 SIMPLE t1 ref v,v_2 # 13 const # Using where
1928 select v,count(*) from t1 group by v limit 10;
1940 select v,count(t) from t1 group by v limit 10;
1952 select v,count(c) from t1 group by v limit 10;
1964 select sql_big_result v,count(t) from t1 group by v limit 10;
1976 select sql_big_result v,count(c) from t1 group by v limit 10;
1988 select c,count(*) from t1 group by c limit 10;
2000 select c,count(t) from t1 group by c limit 10;
2012 select sql_big_result c,count(t) from t1 group by c limit 10;
2024 select t,count(*) from t1 group by t limit 10;
2036 select t,count(t) from t1 group by t limit 10;
2048 select sql_big_result t,count(t) from t1 group by t limit 10;
2060 alter table t1 modify v varchar(300), drop key v, drop key v_2, add key v (v);
2061 show create table t1;
2063 t1 CREATE TABLE `t1` (
2064 `v` varchar(300) DEFAULT NULL,
2065 `c` char(10) DEFAULT NULL,
2070 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
2071 select count(*) from t1 where v='a';
2074 select count(*) from t1 where v='a ';
2077 select count(*) from t1 where v between 'a' and 'a ';
2080 select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
2083 select count(*) from t1 where v like 'a%';
2086 select count(*) from t1 where v like 'a %';
2089 explain select count(*) from t1 where v='a ';
2090 id select_type table type possible_keys key key_len ref rows Extra
2091 1 SIMPLE t1 ref v v 303 const # Using where; Using index
2092 explain select count(*) from t1 where v like 'a%';
2093 id select_type table type possible_keys key key_len ref rows Extra
2094 1 SIMPLE t1 range v v 303 NULL # Using where; Using index
2095 explain select count(*) from t1 where v between 'a' and 'a ';
2096 id select_type table type possible_keys key key_len ref rows Extra
2097 1 SIMPLE t1 ref v v 303 const # Using where; Using index
2098 explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
2099 id select_type table type possible_keys key key_len ref rows Extra
2100 1 SIMPLE t1 ref v v 303 const # Using where; Using index
2101 explain select * from t1 where v='a';
2102 id select_type table type possible_keys key key_len ref rows Extra
2103 1 SIMPLE t1 ref v v 303 const # Using where
2104 select v,count(*) from t1 group by v limit 10;
2116 select v,count(t) from t1 group by v limit 10;
2128 select sql_big_result v,count(t) from t1 group by v limit 10;
2140 alter table t1 drop key v, add key v (v(30));
2141 show create table t1;
2143 t1 CREATE TABLE `t1` (
2144 `v` varchar(300) DEFAULT NULL,
2145 `c` char(10) DEFAULT NULL,
2150 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
2151 select count(*) from t1 where v='a';
2154 select count(*) from t1 where v='a ';
2157 select count(*) from t1 where v between 'a' and 'a ';
2160 select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
2163 select count(*) from t1 where v like 'a%';
2166 select count(*) from t1 where v like 'a %';
2169 explain select count(*) from t1 where v='a ';
2170 id select_type table type possible_keys key key_len ref rows Extra
2171 1 SIMPLE t1 ref v v 33 const # Using where
2172 explain select count(*) from t1 where v like 'a%';
2173 id select_type table type possible_keys key key_len ref rows Extra
2174 1 SIMPLE t1 range v v 33 NULL # Using where
2175 explain select count(*) from t1 where v between 'a' and 'a ';
2176 id select_type table type possible_keys key key_len ref rows Extra
2177 1 SIMPLE t1 ref v v 33 const # Using where
2178 explain select count(*) from t1 where v between 'a' and 'a ' and v between 'a ' and 'b\n';
2179 id select_type table type possible_keys key key_len ref rows Extra
2180 1 SIMPLE t1 ref v v 33 const # Using where
2181 explain select * from t1 where v='a';
2182 id select_type table type possible_keys key key_len ref rows Extra
2183 1 SIMPLE t1 ref v v 33 const # Using where
2184 select v,count(*) from t1 group by v limit 10;
2196 select v,count(t) from t1 group by v limit 10;
2208 select sql_big_result v,count(t) from t1 group by v limit 10;
2220 alter table t1 modify v varchar(600), drop key v, add key v (v);
2221 show create table t1;
2223 t1 CREATE TABLE `t1` (
2224 `v` varchar(600) DEFAULT NULL,
2225 `c` char(10) DEFAULT NULL,
2230 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
2231 select v,count(*) from t1 group by v limit 10;
2243 select v,count(t) from t1 group by v limit 10;
2255 select sql_big_result v,count(t) from t1 group by v limit 10;
2268 create table t1 (a char(10), unique (a));
2269 insert into t1 values ('a ');
2270 insert into t1 values ('a ');
2271 ERROR 23000: Duplicate entry 'a' for key 'a'
2272 alter table t1 modify a varchar(10);
2273 insert into t1 values ('a '),('a '),('a '),('a ');
2274 ERROR 23000: Duplicate entry 'a ' for key 'a'
2275 insert into t1 values ('a ');
2276 ERROR 23000: Duplicate entry 'a ' for key 'a'
2277 insert into t1 values ('a ');
2278 ERROR 23000: Duplicate entry 'a ' for key 'a'
2279 insert into t1 values ('a ');
2280 ERROR 23000: Duplicate entry 'a ' for key 'a'
2281 update t1 set a='a ' where a like 'a%';
2282 select concat(a,'.') from t1;
2285 update t1 set a='abc ' where a like 'a ';
2286 select concat(a,'.') from t1;
2289 update t1 set a='a ' where a like 'a %';
2290 select concat(a,'.') from t1;
2293 update t1 set a='a ' where a like 'a ';
2294 select concat(a,'.') from t1;
2298 create table t1 (v varchar(10), c char(10), t text, key(v(5)), key(c(5)), key(t(5)));
2299 show create table t1;
2301 t1 CREATE TABLE `t1` (
2302 `v` varchar(10) DEFAULT NULL,
2303 `c` char(10) DEFAULT NULL,
2308 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
2310 create table t1 (v char(10) character set utf8);
2311 show create table t1;
2313 t1 CREATE TABLE `t1` (
2314 `v` char(10) CHARACTER SET utf8 DEFAULT NULL
2315 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
2317 create table t1 (v varchar(10), c char(10)) row_format=fixed;
2318 show create table t1;
2320 t1 CREATE TABLE `t1` (
2321 `v` varchar(10) DEFAULT NULL,
2322 `c` char(10) DEFAULT NULL
2323 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=FIXED
2324 insert into t1 values('a','a'),('a ','a ');
2325 select concat('*',v,'*',c,'*') from t1;
2326 concat('*',v,'*',c,'*')
2330 create table t1 (v varchar(65530), key(v(10)));
2331 insert into t1 values(repeat('a',65530));
2332 select length(v) from t1 where v=repeat('a',65530);
2336 create table t1(a int, b varchar(12), key ba(b, a));
2337 insert into t1 values (1, 'A'), (20, NULL);
2338 explain select * from t1 where a=20 and b is null;
2339 id select_type table type possible_keys key key_len ref rows Extra
2340 1 SIMPLE t1 ref ba ba 20 const,const 1 Using where; Using index
2341 select * from t1 where a=20 and b is null;
2345 create table t1 (v varchar(65530), key(v));
2347 Warning 1071 Specified key was too long; max key length is 767 bytes
2349 create table t1 (v varchar(65536));
2351 Note 1246 Converting column 'v' from VARCHAR to TEXT
2352 show create table t1;
2354 t1 CREATE TABLE `t1` (
2356 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
2358 create table t1 (v varchar(65530) character set utf8);
2360 Note 1246 Converting column 'v' from VARCHAR to TEXT
2361 show create table t1;
2363 t1 CREATE TABLE `t1` (
2364 `v` mediumtext CHARACTER SET utf8
2365 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
2367 set storage_engine=MyISAM;