358
354
CREATE TABLE `t8` (
359
`pseudo` varchar(35) character set latin1 NOT NULL default '',
360
`email` varchar(60) character set latin1 NOT NULL default '',
355
`pseudo` varchar(35) NOT NULL default '',
356
`email` varchar(60) NOT NULL default '',
361
357
PRIMARY KEY (`pseudo`),
362
358
UNIQUE KEY `email` (`email`)
363
) ENGINE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC;
359
) ENGINE=MyISAM ROW_FORMAT=DYNAMIC;
364
360
INSERT INTO t8 (pseudo,email) VALUES ('joce','test');
365
361
INSERT INTO t8 (pseudo,email) VALUES ('joce1','test1');
366
362
INSERT INTO t8 (pseudo,email) VALUES ('2joce1','2test1');
367
363
EXPLAIN EXTENDED SELECT pseudo,(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce')) FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce');
368
364
id select_type table type possible_keys key key_len ref rows filtered Extra
369
1 PRIMARY t8 const PRIMARY PRIMARY 37 const 1 100.00 Using index
370
4 SUBQUERY t8 const PRIMARY PRIMARY 37 1 100.00 Using index
371
2 SUBQUERY t8 const PRIMARY PRIMARY 37 const 1 100.00
372
3 SUBQUERY t8 const PRIMARY PRIMARY 37 1 100.00 Using index
365
1 PRIMARY t8 const PRIMARY PRIMARY 142 const 1 100.00 Using index
366
4 SUBQUERY t8 const PRIMARY PRIMARY 142 1 100.00 Using index
367
2 SUBQUERY t8 const PRIMARY PRIMARY 142 const 1 100.00
368
3 SUBQUERY t8 const PRIMARY PRIMARY 142 1 100.00 Using index
374
Note 1003 select 'joce' AS "pseudo",(select 'test' AS "email" from "test"."t8" where 1) AS "(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))" from "test"."t8" where 1
370
Note 1003 select 'joce' AS `pseudo`,(select 'test' AS `email` from `test`.`t8` where ('joce' = (select 'joce' AS `pseudo` from `test`.`t8` where ('joce' = 'joce')))) AS `(SELECT email FROM t8 WHERE pseudo=(SELECT pseudo FROM t8 WHERE pseudo='joce'))` from `test`.`t8` where ('joce' = (select 'joce' AS `pseudo` from `test`.`t8` where ('joce' = 'joce')))
375
371
SELECT pseudo FROM t8 WHERE pseudo=(SELECT pseudo,email FROM
376
372
t8 WHERE pseudo='joce');
377
373
ERROR 21000: Operand should contain 1 column(s)
544
540
id select_type table type possible_keys key key_len ref rows filtered Extra
545
541
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
547
Note 1003 select max("test"."t1"."numreponse") AS "MAX(numreponse)" from "test"."t1" where ("test"."t1"."numeropost" = '1')
543
Note 1003 select max(`test`.`t1`.`numreponse`) AS `MAX(numreponse)` from `test`.`t1` where multiple equal(1, `test`.`t1`.`numeropost`)
548
544
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
549
545
id select_type table type possible_keys key key_len ref rows filtered Extra
550
1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 100.00 Using index
546
1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 12 const,const 1 100.00 Using index
551
547
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
553
Note 1003 select '3' AS "numreponse" from "test"."t1" where (('1' = '1'))
549
Note 1003 select '3' AS `numreponse` from `test`.`t1` where 1
555
CREATE TABLE t1 (a int(1));
551
CREATE TABLE t1 (a int) ENGINE=MyISAM;
556
552
INSERT INTO t1 VALUES (1);
557
553
SELECT 1 FROM (SELECT a FROM t1) b HAVING (SELECT b.a)=1;
561
create table t1 (a int NOT NULL, b int, primary key (a));
562
create table t2 (a int NOT NULL, b int, primary key (a));
557
create table t1 (a int NOT NULL, b int, primary key (a)) ENGINE=MyISAM;
558
create table t2 (a int NOT NULL, b int, primary key (a)) ENGINE=MyISAM;
563
559
insert into t1 values (0, 10),(1, 11),(2, 12);
564
560
insert into t2 values (1, 21),(2, 22),(3, 23);
565
561
select * from t1;
910
906
2 DEPENDENT SUBQUERY t2 ref_or_null a a 5 func 2 100.00 Using index
911
907
2 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer
913
Note 1003 select "test"."t1"."a" AS "a",<in_optimizer>("test"."t1"."a",<exists>(select 1 AS "Not_used" from "test"."t2" join "test"."t3" where (("test"."t3"."a" = "test"."t2"."a") and ((<cache>("test"."t1"."a") = "test"."t2"."a") or isnull("test"."t2"."a"))) having <is_not_null_test>("test"."t2"."a"))) AS "t1.a in (select t2.a from t2,t3 where t3.a=t2.a)" from "test"."t1"
909
Note 1003 select `test`.`t1`.`a` AS `a`,<in_optimizer>(`test`.`t1`.`a`,<exists>(select 1 AS `Not_used` from `test`.`t2` join `test`.`t3` where ((`test`.`t3`.`a` = `test`.`t2`.`a`) and ((<cache>(`test`.`t1`.`a`) = `test`.`t2`.`a`) or isnull(`test`.`t2`.`a`))) having <is_not_null_test>(`test`.`t2`.`a`))) AS `t1.a in (select t2.a from t2,t3 where t3.a=t2.a)` from `test`.`t1`
914
910
drop table t1,t2,t3;
915
create table t1 (a float);
916
select 10.5 IN (SELECT * from t1 LIMIT 1);
917
ERROR 42000: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
918
select 10.5 IN (SELECT * from t1 LIMIT 1 UNION SELECT 1.5);
919
ERROR 42000: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
921
create table t1 (a int, b int, c varchar(10));
922
create table t2 (a int);
923
insert into t1 values (1,2,'a'),(2,3,'b'),(3,4,'c');
924
insert into t2 values (1),(2),(NULL);
925
select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a'),(select c from t1 where a=t2.a) from t2;
926
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,2,'a') (select c from t1 where a=t2.a)
930
select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b'),(select c from t1 where a=t2.a) from t2;
931
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,3,'b') (select c from t1 where a=t2.a)
935
select a, (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c'),(select c from t1 where a=t2.a) from t2;
936
a (select a,b,c from t1 where t1.a=t2.a) = ROW(a,4,'c') (select c from t1 where a=t2.a)
941
create table t1 (a int, b real, c varchar(10));
942
insert into t1 values (1, 1, 'a'), (2,2,'b'), (NULL, 2, 'b');
943
select ROW(1, 1, 'a') IN (select a,b,c from t1);
944
ROW(1, 1, 'a') IN (select a,b,c from t1)
946
select ROW(1, 2, 'a') IN (select a,b,c from t1);
947
ROW(1, 2, 'a') IN (select a,b,c from t1)
949
select ROW(1, 1, 'a') IN (select b,a,c from t1);
950
ROW(1, 1, 'a') IN (select b,a,c from t1)
952
select ROW(1, 1, 'a') IN (select a,b,c from t1 where a is not null);
953
ROW(1, 1, 'a') IN (select a,b,c from t1 where a is not null)
955
select ROW(1, 2, 'a') IN (select a,b,c from t1 where a is not null);
956
ROW(1, 2, 'a') IN (select a,b,c from t1 where a is not null)
958
select ROW(1, 1, 'a') IN (select b,a,c from t1 where a is not null);
959
ROW(1, 1, 'a') IN (select b,a,c from t1 where a is not null)
961
select ROW(1, 1, 'a') IN (select a,b,c from t1 where c='b' or c='a');
962
ROW(1, 1, 'a') IN (select a,b,c from t1 where c='b' or c='a')
964
select ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a');
965
ROW(1, 2, 'a') IN (select a,b,c from t1 where c='b' or c='a')
967
select ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a');
968
ROW(1, 1, 'a') IN (select b,a,c from t1 where c='b' or c='a')
970
select ROW(1, 1, 'a') IN (select b,a,c from t1 limit 2);
971
ERROR 42000: This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery'
973
CREATE TABLE t1 (a int(1));
911
CREATE TABLE t1 (a int) ENGINE=MyISAM;
974
912
EXPLAIN EXTENDED SELECT (SELECT RAND() FROM t1) FROM t1;
975
913
id select_type table type possible_keys key key_len ref rows filtered Extra
976
914
1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
977
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
979
Note 1003 select (select rand() AS "RAND()" from "test"."t1") AS "(SELECT RAND() FROM t1)" from "test"."t1"
980
EXPLAIN EXTENDED SELECT (SELECT ENCRYPT('test') FROM t1) FROM t1;
981
id select_type table type possible_keys key key_len ref rows filtered Extra
982
1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
983
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
985
Note 1003 select (select encrypt('test') AS "ENCRYPT('test')" from "test"."t1") AS "(SELECT ENCRYPT('test') FROM t1)" from "test"."t1"
915
2 SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
917
Note 1003 select (select rand() AS `RAND()` from `test`.`t1`) AS `(SELECT RAND() FROM t1)` from `test`.`t1`
986
918
EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1;
987
919
id select_type table type possible_keys key key_len ref rows filtered Extra
988
920
1 PRIMARY t1 system NULL NULL NULL NULL 0 0.00 const row not found
989
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
921
2 SUBQUERY t1 system NULL NULL NULL NULL 0 0.00 const row not found
991
Note 1003 select (select benchmark(1,1) AS "BENCHMARK(1,1)" from "test"."t1") AS "(SELECT BENCHMARK(1,1) FROM t1)" from "test"."t1"
923
Note 1003 select (select benchmark(1,1) AS `BENCHMARK(1,1)` from `test`.`t1`) AS `(SELECT BENCHMARK(1,1) FROM t1)` from `test`.`t1`
993
925
CREATE TABLE `t1` (
994
`mot` varchar(30) character set latin1 NOT NULL default '',
995
`topic` mediumint(8) unsigned NOT NULL default '0',
926
`mot` varchar(30) NOT NULL default '',
927
`topic` bigint NOT NULL default '0',
996
928
`date` date NOT NULL default '0000-00-00',
997
`pseudo` varchar(35) character set latin1 NOT NULL default '',
929
`pseudo` varchar(35) NOT NULL default '',
998
930
PRIMARY KEY (`mot`,`pseudo`,`date`,`topic`),
999
931
KEY `pseudo` (`pseudo`,`date`,`topic`),
1000
932
KEY `topic` (`topic`)
1001
) ENGINE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC;
933
) ENGINE=MyISAM ROW_FORMAT=DYNAMIC;
1002
934
CREATE TABLE `t2` (
1003
`mot` varchar(30) character set latin1 NOT NULL default '',
1004
`topic` mediumint(8) unsigned NOT NULL default '0',
935
`mot` varchar(30) NOT NULL default '',
936
`topic` bigint NOT NULL default '0',
1005
937
`date` date NOT NULL default '0000-00-00',
1006
`pseudo` varchar(35) character set latin1 NOT NULL default '',
938
`pseudo` varchar(35) NOT NULL default '',
1007
939
PRIMARY KEY (`mot`,`pseudo`,`date`,`topic`),
1008
940
KEY `pseudo` (`pseudo`,`date`,`topic`),
1009
941
KEY `topic` (`topic`)
1010
) ENGINE=MyISAM CHARSET=latin1 ROW_FORMAT=DYNAMIC;
942
) ENGINE=MyISAM ROW_FORMAT=DYNAMIC;
1011
943
CREATE TABLE `t3` (
1012
`numeropost` mediumint(8) unsigned NOT NULL auto_increment,
1013
`maxnumrep` int(10) unsigned NOT NULL default '0',
944
`numeropost` bigint NOT NULL auto_increment,
945
`maxnumrep` int NOT NULL default '0',
1014
946
PRIMARY KEY (`numeropost`),
1015
947
UNIQUE KEY `maxnumrep` (`maxnumrep`)
1016
) ENGINE=MyISAM CHARSET=latin1;
1017
949
INSERT INTO t1 (mot, topic, pseudo) VALUES ('joce','1','joce'),('test','2','test');
1018
950
INSERT INTO t2 (mot, topic, pseudo) VALUES ('joce','1','joce'),('test','2','test');
1019
951
INSERT INTO t3 VALUES (1,1);
1034
966
SELECT * FROM (SELECT 1 as a,(SELECT a)) a;
1037
CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT 1)) a;
1038
SHOW CREATE TABLE t1;
1040
t1 CREATE TABLE "t1" (
1041
"a" int(1) NOT NULL ON UPDATE CURRENT_TIMESTAMP,
1042
"(SELECT 1)" int(1) NOT NULL ON UPDATE CURRENT_TIMESTAMP
1043
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1045
CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a)) a;
1046
SHOW CREATE TABLE t1;
1048
t1 CREATE TABLE "t1" (
1049
"a" int(1) NOT NULL ON UPDATE CURRENT_TIMESTAMP,
1050
"(SELECT a)" int(1) NOT NULL ON UPDATE CURRENT_TIMESTAMP
1051
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1053
CREATE TABLE t1 SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a;
1054
SHOW CREATE TABLE t1;
1056
t1 CREATE TABLE "t1" (
1057
"a" int(1) NOT NULL ON UPDATE CURRENT_TIMESTAMP,
1058
"(SELECT a+0)" int(3) NOT NULL ON UPDATE CURRENT_TIMESTAMP
1059
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1061
CREATE TABLE t1 SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a;
969
CREATE TABLE t1 ENGINE=MyISAM SELECT * FROM (SELECT 1 as a,(SELECT 1)) a;
970
SHOW CREATE TABLE t1;
972
t1 CREATE TABLE `t1` (
974
`(SELECT 1)` int NOT NULL
977
CREATE TABLE t1 ENGINE=MyISAM SELECT * FROM (SELECT 1 as a,(SELECT a)) a;
978
SHOW CREATE TABLE t1;
980
t1 CREATE TABLE `t1` (
982
`(SELECT a)` int NOT NULL
985
CREATE TABLE t1 ENGINE=MyISAM SELECT * FROM (SELECT 1 as a,(SELECT a+0)) a;
986
SHOW CREATE TABLE t1;
988
t1 CREATE TABLE `t1` (
990
`(SELECT a+0)` int NOT NULL
993
CREATE TABLE t1 ENGINE=MyISAM SELECT (SELECT 1 as a UNION SELECT 1+1 limit 1,1) as a;
1062
994
select * from t1;
1065
997
SHOW CREATE TABLE t1;
1066
998
Table Create Table
1067
t1 CREATE TABLE "t1" (
1068
"a" bigint(20) NOT NULL ON UPDATE CURRENT_TIMESTAMP
1069
) ENGINE=MyISAM DEFAULT CHARSET=latin1
999
t1 CREATE TABLE `t1` (
1071
create table t1 (a int);
1003
create table t1 (a int) ENGINE=MyISAM;
1072
1004
insert into t1 values (1), (2), (3);
1073
1005
explain extended select a,(select (select rand() from t1 limit 1) from t1 limit 1)
1075
1007
id select_type table type possible_keys key key_len ref rows filtered Extra
1076
1008
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
1077
2 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00
1078
3 UNCACHEABLE SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00
1009
2 SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00
1010
3 SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00
1080
Note 1003 select "test"."t1"."a" AS "a",(select (select rand() AS "rand()" from "test"."t1" limit 1) AS "(select rand() from t1 limit 1)" from "test"."t1" limit 1) AS "(select (select rand() from t1 limit 1) from t1 limit 1)" from "test"."t1"
1012
Note 1003 select `test`.`t1`.`a` AS `a`,(select (select rand() AS `rand()` from `test`.`t1` limit 1) AS `(select rand() from t1 limit 1)` from `test`.`t1` limit 1) AS `(select (select rand() from t1 limit 1) from t1 limit 1)` from `test`.`t1`
1082
1014
select t1.Continent, t2.Name, t2.Population from t1 LEFT JOIN t2 ON t1.Code = t2.Country where t2.Population IN (select max(t2.Population) AS Population from t2, t1 where t2.Country = t1.Code group by Continent);
1083
1015
ERROR 42S02: Table 'test.t1' doesn't exist
1084
1016
CREATE TABLE t1 (
1085
ID int(11) NOT NULL auto_increment,
1017
ID int NOT NULL auto_increment,
1086
1018
name char(35) NOT NULL default '',
1087
1019
t2 char(3) NOT NULL default '',
1088
1020
District char(20) NOT NULL default '',
1089
Population int(11) NOT NULL default '0',
1021
Population int NOT NULL default '0',
1090
1022
PRIMARY KEY (ID)
1091
1023
) ENGINE=MyISAM;
1092
1024
INSERT INTO t1 VALUES (130,'Sydney','AUS','New South Wales',3276207);
1175
1107
drop table t1,t2;
1176
create table t1 (a int, unique index indexa (a));
1108
create table t1 (a int, unique index indexa (a)) ENGINE=MyISAM;
1177
1109
insert into t1 values (-1), (-4), (-2), (NULL);
1178
1110
select -10 IN (select a from t1 FORCE INDEX (indexa));
1179
1111
-10 IN (select a from t1 FORCE INDEX (indexa))
1182
create table t1 (id int not null auto_increment primary key, salary int, key(salary));
1114
create table t1 (id int not null auto_increment primary key, salary int, key(salary)) ENGINE=MyISAM;
1183
1115
insert into t1 (salary) values (100),(1000),(10000),(10),(500),(5000),(50000);
1184
1116
explain extended SELECT id FROM t1 where salary = (SELECT MAX(salary) FROM t1);
1185
1117
id select_type table type possible_keys key key_len ref rows filtered Extra
1186
1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using index condition
1118
1 PRIMARY t1 ref salary salary 5 const 1 100.00 Using where
1187
1119
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
1189
Note 1003 select "test"."t1"."id" AS "id" from "test"."t1" where ("test"."t1"."salary" = (select max("test"."t1"."salary") AS "MAX(salary)" from "test"."t1"))
1121
Note 1003 select `test`.`t1`.`id` AS `id` from `test`.`t1` where (`test`.`t1`.`salary` = (select max(`test`.`t1`.`salary`) AS `MAX(salary)` from `test`.`t1`))
1191
1123
CREATE TABLE t1 (
1192
ID int(10) unsigned NOT NULL auto_increment,
1193
SUB_ID int(3) unsigned NOT NULL default '0',
1194
REF_ID int(10) unsigned default NULL,
1195
REF_SUB int(3) unsigned default '0',
1124
ID int NOT NULL auto_increment,
1125
SUB_ID int NOT NULL default '0',
1126
REF_ID int default NULL,
1127
REF_SUB int default '0',
1196
1128
PRIMARY KEY (ID,SUB_ID),
1197
1129
UNIQUE KEY t1_PK (ID,SUB_ID),
1198
1130
KEY t1_FK (REF_ID,REF_SUB),
1199
1131
KEY t1_REFID (REF_ID)
1200
) ENGINE=MyISAM CHARSET=cp1251;
1201
1133
INSERT INTO t1 VALUES (1,0,NULL,NULL),(2,0,NULL,NULL);
1202
1134
SELECT DISTINCT REF_ID FROM t1 WHERE ID= (SELECT DISTINCT REF_ID FROM t1 WHERE ID=2);
1205
create table t1 (a int, b int);
1206
create table t2 (a int, b int);
1137
create table t1 (a int, b int) ENGINE=MyISAM;
1138
create table t2 (a int, b int) ENGINE=MyISAM;
1207
1139
insert into t1 values (1,0), (2,0), (3,0);
1208
1140
insert into t2 values (1,1), (2,1), (3,1), (2,2);
1209
1141
update ignore t1 set b=(select b from t2 where t1.a=t2.a);
1340
1272
drop table t1,t2,t3;
1341
create table t1 (s1 int);
1342
create table t2 (s1 int);
1273
create table t1 (s1 int) ENGINE=MyISAM;
1274
create table t2 (s1 int) ENGINE=MyISAM;
1343
1275
insert into t1 values (1);
1344
1276
insert into t2 values (1);
1345
1277
select * from t1 where exists (select s1 from t2 having max(t2.s1)=t1.s1);
1348
1280
drop table t1,t2;
1349
create table t1 (s1 int);
1350
create table t2 (s1 int);
1281
create table t1 (s1 int) ENGINE=MyISAM;
1282
create table t2 (s1 int) ENGINE=MyISAM;
1351
1283
insert into t1 values (1);
1352
1284
insert into t2 values (1);
1353
1285
update t1 set s1 = s1 + 1 where 1 = (select x.s1 as A from t2 WHERE t2.s1 > t1.s1 order by A);
1354
1286
ERROR 42S22: Unknown column 'x.s1' in 'field list'
1355
1287
DROP TABLE t1, t2;
1356
CREATE TABLE t1 (s1 CHAR(5) COLLATE latin1_german1_ci,
1357
s2 CHAR(5) COLLATE latin1_swedish_ci);
1358
INSERT INTO t1 VALUES ('z','?');
1359
select * from t1 where s1 > (select max(s2) from t1);
1360
ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '>'
1361
select * from t1 where s1 > any (select max(s2) from t1);
1362
ERROR HY000: Illegal mix of collations (latin1_german1_ci,IMPLICIT) and (latin1_swedish_ci,IMPLICIT) for operation '>'
1364
create table t1(toid int,rd int);
1365
create table t2(userid int,pmnew int,pmtotal int);
1288
create table t1(toid int,rd int) ENGINE=MyISAM;
1289
create table t2(userid int,pmnew int,pmtotal int) ENGINE=MyISAM;
1366
1290
insert into t2 values(1,0,0),(2,0,0);
1367
1291
insert into t1 values(1,0),(1,0),(1,0),(1,12),(1,15),(1,123),(1,12312),(1,12312),(1,123),(2,0),(2,0),(2,1),(2,2);
1368
1292
select userid,pmtotal,pmnew, (select count(rd) from t1 where toid=t2.userid) calc_total, (select count(rd) from t1 where rd=0 and toid=t2.userid) calc_new from t2 where userid in (select distinct toid from t1);
1413
1337
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2) from t1;
1414
1338
id select_type table type possible_keys key key_len ref rows filtered Extra
1415
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
1416
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
1339
1 PRIMARY t1 index NULL s1 23 NULL 3 100.00 Using index
1340
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 23 func 2 100.00 Using index; Full scan on NULL key
1418
Note 1003 select "test"."t1"."s1" AS "s1",(not(<in_optimizer>("test"."t1"."s1",<exists>(<index_lookup>(<cache>("test"."t1"."s1") in t2 on s1 checking NULL having trigcond(<is_not_null_test>("test"."t2"."s1"))))))) AS "s1 NOT IN (SELECT s1 FROM t2)" from "test"."t1"
1342
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))))) AS `s1 NOT IN (SELECT s1 FROM t2)` from `test`.`t1`
1419
1343
explain extended select s1, s1 = ANY (SELECT s1 FROM t2) from t1;
1420
1344
id select_type table type possible_keys key key_len ref rows filtered Extra
1421
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
1422
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
1345
1 PRIMARY t1 index NULL s1 23 NULL 3 100.00 Using index
1346
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 23 func 2 100.00 Using index; Full scan on NULL key
1424
Note 1003 select "test"."t1"."s1" AS "s1",<in_optimizer>("test"."t1"."s1",<exists>(<index_lookup>(<cache>("test"."t1"."s1") in t2 on s1 checking NULL having trigcond(<is_not_null_test>("test"."t2"."s1"))))) AS "s1 = ANY (SELECT s1 FROM t2)" from "test"."t1"
1348
Note 1003 select `test`.`t1`.`s1` AS `s1`,<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))) AS `s1 = ANY (SELECT s1 FROM t2)` from `test`.`t1`
1425
1349
explain extended select s1, s1 <> ALL (SELECT s1 FROM t2) from t1;
1426
1350
id select_type table type possible_keys key key_len ref rows filtered Extra
1427
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
1428
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Full scan on NULL key
1351
1 PRIMARY t1 index NULL s1 23 NULL 3 100.00 Using index
1352
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 23 func 2 100.00 Using index; Full scan on NULL key
1430
Note 1003 select "test"."t1"."s1" AS "s1",(not(<in_optimizer>("test"."t1"."s1",<exists>(<index_lookup>(<cache>("test"."t1"."s1") in t2 on s1 checking NULL having trigcond(<is_not_null_test>("test"."t2"."s1"))))))) AS "s1 <> ALL (SELECT s1 FROM t2)" from "test"."t1"
1354
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))))) AS `s1 <> ALL (SELECT s1 FROM t2)` from `test`.`t1`
1431
1355
explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1;
1432
1356
id select_type table type possible_keys key key_len ref rows filtered Extra
1433
1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index
1434
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key
1357
1 PRIMARY t1 index NULL s1 23 NULL 3 100.00 Using index
1358
2 DEPENDENT SUBQUERY t2 index_subquery s1 s1 23 func 2 100.00 Using index; Using where; Full scan on NULL key
1436
Note 1003 select "test"."t1"."s1" AS "s1",(not(<in_optimizer>("test"."t1"."s1",<exists>(<index_lookup>(<cache>("test"."t1"."s1") in t2 on s1 checking NULL where ("test"."t2"."s1" < 'a2') having trigcond(<is_not_null_test>("test"."t2"."s1"))))))) AS "s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')" from "test"."t1"
1360
Note 1003 select `test`.`t1`.`s1` AS `s1`,(not(<in_optimizer>(`test`.`t1`.`s1`,<exists>(<index_lookup>(<cache>(`test`.`t1`.`s1`) in t2 on s1 checking NULL where (`test`.`t2`.`s1` < 'a2') having trigcond(<is_not_null_test>(`test`.`t2`.`s1`))))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1`
1437
1361
drop table t1,t2;
1438
create table t2 (a int, b int);
1439
create table t3 (a int);
1362
create table t2 (a int, b int) ENGINE=MyISAM;
1363
create table t3 (a int) ENGINE=MyISAM;
1440
1364
insert into t3 values (6),(7),(3);
1441
1365
select * from t3 where a >= all (select b from t2);
1518
1442
1 PRIMARY t3 ALL NULL NULL NULL NULL 3 100.00 Using where
1519
1443
2 SUBQUERY t2 ALL NULL NULL NULL NULL 4 100.00 Using temporary; Using filesort
1521
Note 1003 select "test"."t3"."a" AS "a" from "test"."t3" where <not>(("test"."t3"."a" <= <max>(select max("test"."t2"."b") AS "max(b)" from "test"."t2" group by "test"."t2"."a")))
1445
Note 1003 select `test`.`t3`.`a` AS `a` from `test`.`t3` where <not>((`test`.`t3`.`a` <= <max>(select max(`test`.`t2`.`b`) AS `max(b)` from `test`.`t2` group by `test`.`t2`.`a`)))
1522
1446
drop table t2, t3;
1523
CREATE TABLE `t1` ( `id` mediumint(9) NOT NULL auto_increment, `taskid` bigint(20) NOT NULL default '0', `dbid` int(11) NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=3 ;
1447
CREATE TABLE `t1` ( `id` bigint NOT NULL auto_increment, `taskid` bigint NOT NULL default '0', `dbid` int NOT NULL default '0', `create_date` datetime NOT NULL default '0000-00-00 00:00:00', `last_update` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`)) ENGINE=MyISAM AUTO_INCREMENT=3 ;
1524
1448
INSERT INTO `t1` (`id`, `taskid`, `dbid`, `create_date`,`last_update`) VALUES (1, 1, 15, '2003-09-29 10:31:36', '2003-09-29 10:31:36'), (2, 1, 21, now(), now());
1525
CREATE TABLE `t2` (`db_id` int(11) NOT NULL auto_increment,`name` varchar(200) NOT NULL default '',`primary_uid` smallint(6) NOT NULL default '0',`secondary_uid` smallint(6) NOT NULL default '0',PRIMARY KEY (`db_id`),UNIQUE KEY `name_2` (`name`),FULLTEXT KEY `name` (`name`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=2147483647;
1449
CREATE TABLE `t2` (`db_id` int NOT NULL auto_increment,`name` varchar(200) NOT NULL default '',`primary_uid` int NOT NULL default '0',`secondary_uid` int NOT NULL default '0',PRIMARY KEY (`db_id`),UNIQUE KEY `name_2` (`name`)) ENGINE=MyISAM AUTO_INCREMENT=2147483647;
1526
1450
INSERT INTO `t2` (`db_id`, `name`, `primary_uid`, `secondary_uid`) VALUES (18, 'Not Set 1', 0, 0),(19, 'Valid', 1, 2),(20, 'Valid 2', 1, 2),(21, 'Should Not Return', 1, 2),(26, 'Not Set 2', 0, 0),(-1, 'ALL DB\'S', 0, 0);
1527
CREATE TABLE `t3` (`taskgenid` mediumint(9) NOT NULL auto_increment,`dbid` int(11) NOT NULL default '0',`taskid` int(11) NOT NULL default '0',`mon` tinyint(4) NOT NULL default '1',`tues` tinyint(4) NOT NULL default '1',`wed` tinyint(4) NOT NULL default '1',`thur` tinyint(4) NOT NULL default '1',`fri` tinyint(4) NOT NULL default '1',`sat` tinyint(4) NOT NULL default '0',`sun` tinyint(4) NOT NULL default '0',`how_often` smallint(6) NOT NULL default '1',`userid` smallint(6) NOT NULL default '0',`active` tinyint(4) NOT NULL default '1',PRIMARY KEY (`taskgenid`)) ENGINE=MyISAM CHARSET=latin1 AUTO_INCREMENT=2 ;
1451
CREATE TABLE `t3` (`taskgenid` bigint NOT NULL auto_increment,`dbid` int NOT NULL default '0',`taskid` int NOT NULL default '0',`mon` int NOT NULL default '1',`tues` int NOT NULL default '1',`wed` int NOT NULL default '1',`thur` int NOT NULL default '1',`fri` int NOT NULL default '1',`sat` int NOT NULL default '0',`sun` int NOT NULL default '0',`how_often` int NOT NULL default '1',`userid` int NOT NULL default '0',`active` int NOT NULL default '1',PRIMARY KEY (`taskgenid`)) ENGINE=MyISAM AUTO_INCREMENT=2 ;
1528
1452
INSERT INTO `t3` (`taskgenid`, `dbid`, `taskid`, `mon`, `tues`,`wed`, `thur`, `fri`, `sat`, `sun`, `how_often`, `userid`, `active`) VALUES (1,-1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1);
1529
CREATE TABLE `t4` (`task_id` smallint(6) NOT NULL default '0',`description` varchar(200) NOT NULL default '') ENGINE=MyISAM CHARSET=latin1;
1453
CREATE TABLE `t4` (`task_id` int NOT NULL default '0',`description` varchar(200) NOT NULL default '') ENGINE=MyISAM;
1530
1454
INSERT INTO `t4` (`task_id`, `description`) VALUES (1, 'Daily Check List'),(2, 'Weekly Status');
1531
1455
select dbid, name, (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01') from t3 a, t2 b, t4 WHERE dbid = - 1 AND primary_uid = '1' AND t4.task_id = taskid;
1532
1456
dbid name (date_format(now() , '%Y-%m-%d') - INTERVAL how_often DAY) >= ifnull((SELECT date_format(max(create_date),'%Y-%m-%d') FROM t1 WHERE dbid = b.db_id AND taskid = a.taskgenid), '1950-01-01')
1602
1526
CREATE TABLE `t1` (
1603
`id` int(11) NOT NULL auto_increment,
1604
`id_cns` tinyint(3) unsigned NOT NULL default '0',
1527
`id` int NOT NULL auto_increment,
1528
`id_cns` int NOT NULL default '0',
1605
1529
`tipo` enum('','UNO','DUE') NOT NULL default '',
1606
`anno_dep` smallint(4) unsigned zerofill NOT NULL default '0000',
1607
`particolare` mediumint(8) unsigned NOT NULL default '0',
1608
`generale` mediumint(8) unsigned NOT NULL default '0',
1609
`bis` tinyint(3) unsigned NOT NULL default '0',
1530
`anno_dep` int NOT NULL default '0',
1531
`particolare` bigint NOT NULL default '0',
1532
`generale` bigint NOT NULL default '0',
1533
`bis` int NOT NULL default '0',
1610
1534
PRIMARY KEY (`id`),
1611
1535
UNIQUE KEY `idx_cns_gen_anno` (`anno_dep`,`id_cns`,`generale`,`particolare`),
1612
UNIQUE KEY `idx_cns_par_anno` (`id_cns`,`anno_dep`,`tipo`,`particolare`,`bis`)
1536
UNIQUE KEY `idx_cns_par_anno` (`id_cns`,`anno_dep`,`tipo`,`particolare`,`bis`))
1614
1538
INSERT INTO `t1` VALUES (1,16,'UNO',1987,2048,9681,0),(2,50,'UNO',1987,1536,13987,0),(3,16,'UNO',1987,2432,14594,0),(4,16,'UNO',1987,1792,13422,0),(5,16,'UNO',1987,1025,10240,0),(6,16,'UNO',1987,1026,7089,0);
1615
1539
CREATE TABLE `t2` (
1616
`id` tinyint(3) unsigned NOT NULL auto_increment,
1617
`max_anno_dep` smallint(6) unsigned NOT NULL default '0',
1540
`id` int NOT NULL auto_increment,
1541
`max_anno_dep` int NOT NULL default '0',
1542
PRIMARY KEY (`id`)) ENGINE=MyISAM;
1620
1543
INSERT INTO `t2` VALUES (16,1987),(50,1990),(51,1990);
1621
1544
SELECT cns.id, cns.max_anno_dep, cns.max_anno_dep = (SELECT s.anno_dep FROM t1 AS s WHERE s.id_cns = cns.id ORDER BY s.anno_dep DESC LIMIT 1) AS PIPPO FROM t2 AS cns;
1622
1545
id max_anno_dep PIPPO
1670
1593
1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 Using where
1671
1594
2 DEPENDENT SUBQUERY t1 unique_subquery PRIMARY PRIMARY 4 func 1 100.00 Using index; Using where
1673
Note 1003 select "test"."t1"."id" AS "id","test"."t1"."text" AS "text" from "test"."t1" where (not(<in_optimizer>("test"."t1"."id",<exists>(<primary_index_lookup>(<cache>("test"."t1"."id") in t1 on PRIMARY where (("test"."t1"."id" < 8) and (<cache>("test"."t1"."id") = "test"."t1"."id")))))))
1596
Note 1003 select `test`.`t1`.`id` AS `id`,`test`.`t1`.`text` AS `text` from `test`.`t1` where (not(<in_optimizer>(`test`.`t1`.`id`,<exists>(<primary_index_lookup>(<cache>(`test`.`t1`.`id`) in t1 on PRIMARY where ((`test`.`t1`.`id` < 8) and (<cache>(`test`.`t1`.`id`) = `test`.`t1`.`id`)))))))
1674
1597
explain extended select * from t1 as tt where not exists (select id from t1 where id < 8 and (id = tt.id or id is null) having id is not null);
1675
1598
id select_type table type possible_keys key key_len ref rows filtered Extra
1676
1599
1 PRIMARY tt ALL NULL NULL NULL NULL 12 100.00 Using where
1677
1600
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
1679
1602
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
1680
Note 1003 select "test"."tt"."id" AS "id","test"."tt"."text" AS "text" from "test"."t1" "tt" where (not(exists(select "test"."t1"."id" AS "id" from "test"."t1" where (("test"."t1"."id" < 8) and ("test"."t1"."id" = "test"."tt"."id")) having ("test"."t1"."id" is not null))))
1603
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(exists(select `test`.`t1`.`id` AS `id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))
1681
1604
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
1682
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
1605
create table t2 (id int not null, text varchar(20) not null default '', primary key (id)) ENGINE=MyISAM;
1683
1606
insert into t2 (id, text) values (1, 'text1'), (2, 'text2'), (3, 'text3'), (4, 'text4'), (5, 'text5'), (6, 'text6'), (7, 'text7'), (8, 'text8'), (9, 'text9'), (10, 'text10'), (11, 'text1'), (12, 'text2'), (13, 'text3'), (14, 'text4'), (15, 'text5'), (16, 'text6'), (17, 'text7'), (18, 'text8'), (19, 'text9'), (20, 'text10'),(21, 'text1'), (22, 'text2'), (23, 'text3'), (24, 'text4'), (25, 'text5'), (26, 'text6'), (27, 'text7'), (28, 'text8'), (29, 'text9'), (30, 'text10'), (31, 'text1'), (32, 'text2'), (33, 'text3'), (34, 'text4'), (35, 'text5'), (36, 'text6'), (37, 'text7'), (38, 'text8'), (39, 'text9'), (40, 'text10'), (41, 'text1'), (42, 'text2'), (43, 'text3'), (44, 'text4'), (45, 'text5'), (46, 'text6'), (47, 'text7'), (48, 'text8'), (49, 'text9'), (50, 'text10');
1684
1607
select * from t1 a left join t2 b on (a.id=b.id or b.id is null) join t1 c on (if(isnull(b.id), 1000, b.id)=c.id);
1685
1608
id text id text id text
1701
1624
id select_type table type possible_keys key key_len ref rows filtered Extra
1702
1625
1 SIMPLE a ALL NULL NULL NULL NULL 14 100.00
1703
1626
1 SIMPLE b eq_ref PRIMARY PRIMARY 4 test.a.id 2 100.00
1704
1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using index condition
1627
1 SIMPLE c eq_ref PRIMARY PRIMARY 4 func 1 100.00 Using where
1706
Note 1003 select "test"."a"."id" AS "id","test"."a"."text" AS "text","test"."b"."id" AS "id","test"."b"."text" AS "text","test"."c"."id" AS "id","test"."c"."text" AS "text" from "test"."t1" "a" left join "test"."t2" "b" on((("test"."b"."id" = "test"."a"."id") or isnull("test"."b"."id"))) join "test"."t1" "c" where (if(isnull("test"."b"."id"),1000,"test"."b"."id") = "test"."c"."id")
1629
Note 1003 select `test`.`a`.`id` AS `id`,`test`.`a`.`text` AS `text`,`test`.`b`.`id` AS `id`,`test`.`b`.`text` AS `text`,`test`.`c`.`id` AS `id`,`test`.`c`.`text` AS `text` from `test`.`t1` `a` left join `test`.`t2` `b` on(((`test`.`b`.`id` = `test`.`a`.`id`) or isnull(`test`.`b`.`id`))) join `test`.`t1` `c` where (if(isnull(`test`.`b`.`id`),1000,`test`.`b`.`id`) = `test`.`c`.`id`)
1707
1630
drop table t1,t2;
1708
create table t1 (a int);
1631
create table t1 (a int) ENGINE=MyISAM;
1709
1632
insert into t1 values (1);
1710
explain select benchmark(1000, (select a from t1 where a=sha(rand())));
1633
explain select benchmark(1000, (select a from t1 where a=rand()));
1711
1634
id select_type table type possible_keys key key_len ref rows Extra
1712
1635
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL No tables used
1713
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 1
1636
2 SUBQUERY t1 system NULL NULL NULL NULL 1
1715
create table t1(id int);
1716
create table t2(id int);
1717
create table t3(flag int);
1638
create table t1(id int) ENGINE=MyISAM;
1639
create table t2(id int) ENGINE=MyISAM;
1640
create table t3(flag int) ENGINE=MyISAM;
1718
1641
select (select * from t3 where id not null) from t1, t2;
1719
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'null) from t1, t2' at line 1
1642
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'null) from t1, t2' at line 1
1720
1643
drop table t1,t2,t3;
1721
CREATE TABLE t1 (id INT);
1722
CREATE TABLE t2 (id INT);
1644
CREATE TABLE t1 (id INT) ENGINE=MyISAM;
1645
CREATE TABLE t2 (id INT) ENGINE=MyISAM;
1723
1646
INSERT INTO t1 VALUES (1), (2);
1724
1647
INSERT INTO t2 VALUES (1);
1725
1648
SELECT t1.id, ( SELECT COUNT(t.id) FROM t2 AS t WHERE t.id = t1.id ) AS c FROM t1 LEFT JOIN t2 USING (id);
2234
2157
2 Rebecca 2 Spot
2236
2159
drop table t1,t2;
2237
CREATE TABLE `t1` ( `a` int(11) default NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;
2160
CREATE TABLE `t1` ( `a` int default NULL) ENGINE=MyISAM;
2238
2161
insert into t1 values (1);
2239
CREATE TABLE `t2` ( `b` int(11) default NULL, `a` int(11) default NULL) ENGINE=MyISAM DEFAULT CHARSET=latin1;
2162
CREATE TABLE `t2` ( `b` int default NULL, `a` int default NULL) ENGINE=MyISAM;
2240
2163
insert into t2 values (1,2);
2241
2164
select t000.a, count(*) `C` FROM t1 t000 GROUP BY t000.a HAVING count(*) > ALL (SELECT count(*) FROM t2 t001 WHERE t001.a=1);
2244
2167
drop table t1,t2;
2245
create table t1 (a int not null auto_increment primary key, b varchar(40), fulltext(b));
2246
insert into t1 (b) values ('ball'),('ball games'), ('games'), ('foo'), ('foobar'), ('Serg'), ('Sergei'),('Georg'), ('Patrik'),('Hakan');
2247
create table t2 (a int);
2248
insert into t2 values (1),(3),(2),(7);
2249
select a,b from t1 where match(b) against ('Ball') > 0;
2253
select a from t2 where a in (select a from t1 where match(b) against ('Ball') > 0);
2258
CREATE TABLE t1(`IZAVORGANG_ID` VARCHAR(11) CHARACTER SET latin1 COLLATE latin1_bin,`KUERZEL` VARCHAR(10) CHARACTER SET latin1 COLLATE latin1_bin,`IZAANALYSEART_ID` VARCHAR(11) CHARACTER SET latin1 COLLATE latin1_bin,`IZAPMKZ_ID` VARCHAR(11) CHARACTER SET latin1 COLLATE latin1_bin);
2168
CREATE TABLE t1(`IZAVORGANG_ID` VARCHAR(11) COLLATE utf8_bin,`KUERZEL` VARCHAR(10) COLLATE utf8_bin,`IZAANALYSEART_ID` VARCHAR(11) COLLATE utf8_bin,`IZAPMKZ_ID` VARCHAR(11) COLLATE utf8_bin) ENGINE=MyISAM;
2259
2169
CREATE INDEX AK01IZAVORGANG ON t1(izaAnalyseart_id,Kuerzel);
2260
2170
INSERT INTO t1(`IZAVORGANG_ID`,`KUERZEL`,`IZAANALYSEART_ID`,`IZAPMKZ_ID`)VALUES('D0000000001','601','D0000000001','I0000000001');
2261
2171
INSERT INTO t1(`IZAVORGANG_ID`,`KUERZEL`,`IZAANALYSEART_ID`,`IZAPMKZ_ID`)VALUES('D0000000002','602','D0000000001','I0000000001');
2323
create table t1 (x int);
2233
create table t1 (x int) ENGINE=MyISAM;
2324
2234
select (select b.x from t1 as b where b.x=a.x) from t1 as a where a.x=2 group by a.x;
2325
2235
(select b.x from t1 as b where b.x=a.x)
2327
CREATE TABLE `t1` ( `master` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `slave` int(10) unsigned NOT NULL default '0', `access` int(10) unsigned NOT NULL default '0', UNIQUE KEY `access_u` (`master`,`map`,`slave`));
2237
CREATE TABLE `t1` ( `master` int NOT NULL default '0', `map` int NOT NULL default '0', `slave` int NOT NULL default '0', `access` int NOT NULL default '0', UNIQUE KEY `access_u` (`master`,`map`,`slave`)) ENGINE=MyISAM;
2328
2238
INSERT INTO `t1` VALUES (1,0,0,700),(1,1,1,400),(1,5,5,400),(1,12,12,400),(1,12,32,400),(4,12,32,400);
2329
CREATE TABLE `t2` ( `id` int(10) unsigned NOT NULL default '0', `pid` int(10) unsigned NOT NULL default '0', `map` smallint(6) unsigned NOT NULL default '0', `level` tinyint(4) unsigned NOT NULL default '0', `title` varchar(255) default NULL, PRIMARY KEY (`id`,`pid`,`map`), KEY `level` (`level`), KEY `id` (`id`,`map`)) ;
2239
CREATE TABLE `t2` ( `id` int NOT NULL default '0', `pid` int NOT NULL default '0', `map` int NOT NULL default '0', `level` int NOT NULL default '0', `title` varchar(255) default NULL, PRIMARY KEY (`id`,`pid`,`map`), KEY `level` (`level`), KEY `id` (`id`,`map`)) ENGINE=MyISAM ;
2330
2240
INSERT INTO `t2` VALUES (6,5,12,7,'a'),(12,0,0,7,'a'),(12,1,0,7,'a'),(12,5,5,7,'a'),(12,5,12,7,'a');
2331
2241
SELECT b.sc FROM (SELECT (SELECT a.access FROM t1 a WHERE a.map = op.map AND a.slave = op.pid AND a.master = 1) ac FROM t2 op WHERE op.id = 12 AND op.map = 0) b;
2332
2242
ERROR 42S22: Unknown column 'b.sc' in 'field list'
2376
2278
Continent enum('Asia','Europe','North America','Africa','Oceania','Antarctica','South America') NOT NULL default 'Asia',
2377
2279
Region char(26) NOT NULL default '',
2378
2280
SurfaceArea float(10,2) NOT NULL default '0.00',
2379
IndepYear smallint(6) default NULL,
2380
Population int(11) NOT NULL default '0',
2281
IndepYear int default NULL,
2282
Population int NOT NULL default '0',
2381
2283
LifeExpectancy float(3,1) default NULL,
2382
2284
GNP float(10,2) default NULL,
2383
2285
GNPOld float(10,2) default NULL,
2384
2286
LocalName char(45) NOT NULL default '',
2385
2287
GovernmentForm char(45) NOT NULL default '',
2386
2288
HeadOfState char(60) default NULL,
2387
Capital int(11) default NULL,
2289
Capital int default NULL,
2388
2290
Code2 char(2) NOT NULL default ''
2389
2291
) ENGINE=MyISAM;
2390
2292
INSERT INTO t1 VALUES ('XXX','Xxxxx','Oceania','Xxxxxx',26.00,0,0,0,0,0,'Xxxxx','Xxxxx','Xxxxx',NULL,'XX');
2471
2371
(5141,87,'2004-10-21'),(5141,88,'2004-10-21'),
2472
2372
(5141,89,'2004-10-22'),(5141,51,'2004-10-26');
2473
2373
CREATE TABLE t3 (
2474
groupId int(11) NOT NULL,
2475
parentId int(11) NOT NULL,
2374
groupId int NOT NULL,
2375
parentId int NOT NULL,
2476
2376
startDate datetime NOT NULL,
2477
2377
endDate datetime NOT NULL,
2478
2378
createDate datetime NOT NULL,
2479
2379
modifyDate timestamp NOT NULL,
2482
2382
INSERT INTO t3 VALUES (12,9,'1000-01-01','3999-12-31','2004-01-29','2004-01-29',NULL);
2483
2383
CREATE TABLE t4 (
2484
id int(11) NOT NULL,
2485
groupTypeId int(11) NOT NULL,
2385
groupTypeId int NOT NULL,
2486
2386
groupKey varchar(50) NOT NULL,
2489
2389
description text,
2490
2390
createDate datetime NOT NULL,
2491
modifyDate timestamp NOT NULL
2391
modifyDate timestamp NOT NULL)
2493
2393
INSERT INTO t4 VALUES (9,5,'stationer','stationer',0,'Stationer','2004-01-29','2004-01-29'),
2494
2394
(12,5,'group2','group2',0,'group2','2004-01-29','2004-01-29');
2495
2395
CREATE TABLE t5 (
2496
userId int(11) NOT NULL,
2497
groupId int(11) NOT NULL,
2396
userId int NOT NULL,
2397
groupId int NOT NULL,
2498
2398
createDate datetime NOT NULL,
2499
modifyDate timestamp NOT NULL
2399
modifyDate timestamp NOT NULL) ENGINE=MyISAM;
2501
2400
INSERT INTO t5 VALUES (5141,12,'2004-08-06','2004-08-06');
2503
2402
count(distinct t2.userid) pass,
2564
2463
select (select * from t1) = (1,2,3);
2565
2464
ERROR 21000: Operand should contain 2 column(s)
2568
`itemid` bigint(20) unsigned NOT NULL auto_increment,
2569
`sessionid` bigint(20) unsigned default NULL,
2570
`time` int(10) unsigned NOT NULL default '0',
2571
`type` set('A','D','E','F','G','I','L','N','U') collate latin1_general_ci NOT
2573
`data` text collate latin1_general_ci NOT NULL,
2574
PRIMARY KEY (`itemid`)
2575
) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
2576
INSERT INTO `t1` VALUES (1, 1, 1, 'D', '');
2578
`sessionid` bigint(20) unsigned NOT NULL auto_increment,
2579
`pid` int(10) unsigned NOT NULL default '0',
2580
`date` int(10) unsigned NOT NULL default '0',
2581
`ip` varchar(15) collate latin1_general_ci NOT NULL default '',
2582
PRIMARY KEY (`sessionid`)
2583
) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
2584
INSERT INTO `t2` VALUES (1, 1, 1, '10.10.10.1');
2585
SELECT s.ip, count( e.itemid ) FROM `t1` e JOIN t2 s ON s.sessionid = e.sessionid WHERE e.sessionid = ( SELECT sessionid FROM t2 ORDER BY sessionid DESC LIMIT 1 ) GROUP BY s.ip HAVING count( e.itemid ) >0 LIMIT 0 , 30;
2586
ip count( e.itemid )
2589
create table t1 (fld enum('0','1'));
2466
create table t1 (fld enum('0','1')) ENGINE=MyISAM;
2590
2467
insert into t1 values ('1');
2591
2468
select * from (select max(fld) from t1) as foo;
2595
CREATE TABLE t1 (one int, two int, flag char(1));
2596
CREATE TABLE t2 (one int, two int, flag char(1));
2472
CREATE TABLE t1 (one int, two int, flag char(1)) ENGINE=MyISAM;
2473
CREATE TABLE t2 (one int, two int, flag char(1)) ENGINE=MyISAM;
2597
2474
INSERT INTO t1 VALUES(1,2,'Y'),(2,3,'Y'),(3,4,'Y'),(5,6,'N'),(7,8,'N');
2598
2475
INSERT INTO t2 VALUES(1,2,'Y'),(2,3,'Y'),(3,4,'Y'),(5,6,'N'),(7,8,'N');
2599
2476
SELECT * FROM t1
2662
2539
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
2663
2540
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where
2665
Note 1003 select "test"."t1"."one" AS "one","test"."t1"."two" AS "two",<in_optimizer>(("test"."t1"."one","test"."t1"."two"),<exists>(select "test"."t2"."one" AS "one","test"."t2"."two" AS "two" from "test"."t2" where (("test"."t2"."flag" = '0') and trigcond(((<cache>("test"."t1"."one") = "test"."t2"."one") or isnull("test"."t2"."one"))) and trigcond(((<cache>("test"."t1"."two") = "test"."t2"."two") or isnull("test"."t2"."two")))) having (trigcond(<is_not_null_test>("test"."t2"."one")) and trigcond(<is_not_null_test>("test"."t2"."two"))))) AS "test" from "test"."t1"
2542
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where ((`test`.`t2`.`flag` = '0') and trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`)))) having (trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
2666
2543
explain extended SELECT one,two from t1 where ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = 'N');
2667
2544
id select_type table type possible_keys key key_len ref rows filtered Extra
2668
2545
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00 Start temporary
2669
2546
1 PRIMARY t2 ALL NULL NULL NULL NULL 9 100.00 Using where; End temporary; Using join buffer
2671
Note 1003 select "test"."t1"."one" AS "one","test"."t1"."two" AS "two" from "test"."t1" semi join ("test"."t2") where (("test"."t2"."two" = "test"."t1"."two") and ("test"."t2"."one" = "test"."t1"."one") and ("test"."t2"."flag" = 'N'))
2548
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two` from `test`.`t1` semi join (`test`.`t2`) where ((`test`.`t2`.`two` = `test`.`t1`.`two`) and (`test`.`t2`.`one` = `test`.`t1`.`one`) and (`test`.`t2`.`flag` = 'N'))
2672
2549
explain extended SELECT one,two,ROW(one,two) IN (SELECT one,two FROM t2 WHERE flag = '0' group by one,two) as 'test' from t1;
2673
2550
id select_type table type possible_keys key key_len ref rows filtered Extra
2674
2551
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 100.00
2675
2552
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 9 100.00 Using where; Using temporary; Using filesort
2677
Note 1003 select "test"."t1"."one" AS "one","test"."t1"."two" AS "two",<in_optimizer>(("test"."t1"."one","test"."t1"."two"),<exists>(select "test"."t2"."one" AS "one","test"."t2"."two" AS "two" from "test"."t2" where ("test"."t2"."flag" = '0') group by "test"."t2"."one","test"."t2"."two" having (trigcond(((<cache>("test"."t1"."one") = "test"."t2"."one") or isnull("test"."t2"."one"))) and trigcond(((<cache>("test"."t1"."two") = "test"."t2"."two") or isnull("test"."t2"."two"))) and trigcond(<is_not_null_test>("test"."t2"."one")) and trigcond(<is_not_null_test>("test"."t2"."two"))))) AS "test" from "test"."t1"
2554
Note 1003 select `test`.`t1`.`one` AS `one`,`test`.`t1`.`two` AS `two`,<in_optimizer>((`test`.`t1`.`one`,`test`.`t1`.`two`),<exists>(select `test`.`t2`.`one` AS `one`,`test`.`t2`.`two` AS `two` from `test`.`t2` where (`test`.`t2`.`flag` = '0') group by `test`.`t2`.`one`,`test`.`t2`.`two` having (trigcond(((<cache>(`test`.`t1`.`one`) = `test`.`t2`.`one`) or isnull(`test`.`t2`.`one`))) and trigcond(((<cache>(`test`.`t1`.`two`) = `test`.`t2`.`two`) or isnull(`test`.`t2`.`two`))) and trigcond(<is_not_null_test>(`test`.`t2`.`one`)) and trigcond(<is_not_null_test>(`test`.`t2`.`two`))))) AS `test` from `test`.`t1`
2678
2555
DROP TABLE t1,t2;
2679
CREATE TABLE t1 (a char(5), b char(5));
2556
CREATE TABLE t1 (a char(5), b char(5)) ENGINE=MyISAM;
2680
2557
INSERT INTO t1 VALUES (NULL,'aaa'), ('aaa','aaa');
2681
2558
SELECT * FROM t1 WHERE (a,b) IN (('aaa','aaa'), ('aaa','bbb'));
2685
CREATE TABLE t1 (a int);
2686
CREATE TABLE t2 (a int, b int);
2687
CREATE TABLE t3 (b int NOT NULL);
2562
CREATE TABLE t1 (a int) ENGINE=MyISAM;
2563
CREATE TABLE t2 (a int, b int) ENGINE=MyISAM;
2564
CREATE TABLE t3 (b int NOT NULL) ENGINE=MyISAM;
2688
2565
INSERT INTO t1 VALUES (1), (2), (3), (4);
2689
2566
INSERT INTO t2 VALUES (1,10), (3,30);
2690
2567
SELECT * FROM t2 LEFT JOIN t3 ON t2.b=t3.b
2781
2640
0048 1 2006-01-06 12:37:50
2782
2641
0059 1 2006-01-06 12:37:50
2784
create table t1(a int, primary key (a));
2643
create table t1(a int, primary key (a)) ENGINE=MyISAM;
2785
2644
insert into t1 values (10);
2786
create table t2 (a int primary key, b varchar(32), c int, unique key b(c, b));
2645
create table t2 (a int primary key, b varchar(32), c int, unique key b(c, b)) ENGINE=MyISAM;
2787
2646
insert into t2(a, c, b) values (1,10,'359'), (2,10,'35988'), (3,10,'35989');
2788
explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
2647
explain SELECT t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
2789
2648
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
2790
2649
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
2791
2650
id select_type table type possible_keys key key_len ref rows Extra
2792
2651
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
2793
2652
1 PRIMARY r const PRIMARY PRIMARY 4 const 1
2794
2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using index condition
2795
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
2653
2 DEPENDENT SUBQUERY t2 range b b 136 NULL 2 Using where
2654
SELECT t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
2796
2655
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
2797
2656
ORDER BY t2.c DESC, t2.b DESC LIMIT 1) WHERE t1.a = 10;
2800
explain SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
2659
explain SELECT t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
2801
2660
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
2802
2661
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
2803
2662
id select_type table type possible_keys key key_len ref rows Extra
2804
2663
1 PRIMARY t1 system PRIMARY NULL NULL NULL 1
2805
2664
1 PRIMARY r const PRIMARY PRIMARY 4 const 1
2806
2 DEPENDENT SUBQUERY t2 range b b 40 NULL 2 Using index condition; Using MRR
2807
SELECT sql_no_cache t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
2665
2 DEPENDENT SUBQUERY t2 range b b 136 NULL 2 Using where; Using MRR
2666
SELECT t1.a, r.a, r.b FROM t1 LEFT JOIN t2 r
2808
2667
ON r.a = (SELECT t2.a FROM t2 WHERE t2.c = t1.a AND t2.b <= '359899'
2809
2668
ORDER BY t2.c, t2.b LIMIT 1) WHERE t1.a = 10;
2863
2722
DROP TABLE t1,t2;
2864
CREATE TABLE t1 (a DATETIME);
2723
CREATE TABLE t1 (a DATETIME) ENGINE=MyISAM;
2865
2724
INSERT INTO t1 VALUES ('1998-09-23'), ('2003-03-25');
2866
CREATE TABLE t2 AS SELECT
2725
CREATE TABLE t2 ENGINE=MyISAM AS SELECT
2867
2726
(SELECT a FROM t1 WHERE a < '2000-01-01') AS sub_a
2868
2727
FROM t1 WHERE a > '2000-01-01';
2869
2728
SHOW CREATE TABLE t2;
2870
2729
Table Create Table
2871
t2 CREATE TABLE "t2" (
2872
"sub_a" datetime ON UPDATE CURRENT_TIMESTAMP
2873
) ENGINE=MyISAM DEFAULT CHARSET=latin1
2874
CREATE TABLE t3 AS (SELECT a FROM t1 WHERE a < '2000-01-01') UNION (SELECT a FROM t1 WHERE a > '2000-01-01');
2730
t2 CREATE TABLE `t2` (
2733
CREATE TABLE t3 ENGINE=MyISAM AS (SELECT a FROM t1 WHERE a < '2000-01-01') UNION (SELECT a FROM t1 WHERE a > '2000-01-01');
2875
2734
SHOW CREATE TABLE t3;
2876
2735
Table Create Table
2877
t3 CREATE TABLE "t3" (
2878
"a" datetime ON UPDATE CURRENT_TIMESTAMP
2879
) ENGINE=MyISAM DEFAULT CHARSET=latin1
2736
t3 CREATE TABLE `t3` (
2880
2739
DROP TABLE t1,t2,t3;
2881
CREATE TABLE t1 (a int);
2882
INSERT INTO t1 VALUES (1), (2);
2883
SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) > 0;
2885
SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL;
2889
EXPLAIN SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL;
2890
id select_type table type possible_keys key key_len ref rows Extra
2891
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
2892
2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2894
CREATE TABLE t1 (a int);
2740
CREATE TABLE t1 (a int) ENGINE=MyISAM;
2895
2741
INSERT INTO t1 VALUES (2), (4), (1), (3);
2896
CREATE TABLE t2 (b int, c int);
2742
CREATE TABLE t2 (b int, c int) ENGINE=MyISAM;
2897
2743
INSERT INTO t2 VALUES
2898
2744
(2,1), (1,3), (2,1), (4,4), (2,2), (1,4);
2899
2745
SELECT a FROM t1 ORDER BY (SELECT c FROM t2 WHERE b > 2 );
3038
2884
DROP TABLE t1,t2,t3;
3040
`itemid` bigint(20) unsigned NOT NULL auto_increment,
3041
`sessionid` bigint(20) unsigned default NULL,
3042
`time` int(10) unsigned NOT NULL default '0',
3043
`type` set('A','D','E','F','G','I','L','N','U') collate latin1_general_ci NOT
3045
`data` text collate latin1_general_ci NOT NULL,
3046
PRIMARY KEY (`itemid`)
3047
) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
3048
INSERT INTO `t1` VALUES (1, 1, 1, 'D', '');
3050
`sessionid` bigint(20) unsigned NOT NULL auto_increment,
3051
`pid` int(10) unsigned NOT NULL default '0',
3052
`date` int(10) unsigned NOT NULL default '0',
3053
`ip` varchar(15) collate latin1_general_ci NOT NULL default '',
3054
PRIMARY KEY (`sessionid`)
3055
) DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
3056
INSERT INTO `t2` VALUES (1, 1, 1, '10.10.10.1');
3057
SELECT s.ip, count( e.itemid ) FROM `t1` e JOIN t2 s ON s.sessionid = e.sessionid WHERE e.sessionid = ( SELECT sessionid FROM t2 ORDER BY sessionid DESC LIMIT 1 ) GROUP BY s.ip HAVING count( e.itemid ) >0 LIMIT 0 , 30;
3058
ip count( e.itemid )
3061
CREATE TABLE t1 (EMPNUM CHAR(3));
3062
CREATE TABLE t2 (EMPNUM CHAR(3) );
2885
CREATE TABLE t1 (EMPNUM CHAR(3)) ENGINE=MyISAM;
2886
CREATE TABLE t2 (EMPNUM CHAR(3) ) ENGINE=MyISAM;
3063
2887
INSERT INTO t1 VALUES ('E1'),('E2');
3064
2888
INSERT INTO t2 VALUES ('E1');
3267
3091
1 PRIMARY t1 ALL NULL NULL NULL NULL 9 Using where
3268
3092
2 SUBQUERY t1 ALL NULL NULL NULL NULL 9 Using temporary; Using filesort
3270
create table t1( f1 int,f2 int);
3094
create table t1( f1 int,f2 int) ENGINE=MyISAM;
3271
3095
insert into t1 values (1,1),(2,2);
3272
3096
select tt.t from (select 'crash1' as t, f2 from t1) as tt left join t1 on tt.t = 'crash2' and tt.f2 = t1.f2 where tt.t = 'crash1';
3277
create table t1 (c int, key(c));
3101
create table t1 (c int, key(c)) ENGINE=MyISAM;
3278
3102
insert into t1 values (1142477582), (1142455969);
3279
create table t2 (a int, b int);
3103
create table t2 (a int, b int) ENGINE=MyISAM;
3280
3104
insert into t2 values (2, 1), (1, 0);
3281
3105
delete from t1 where c <= 1140006215 and (select b from t2 where a = 2) = 1;
3282
3106
drop table t1, t2;
3283
create table t1 (i int, j bigint);
3107
create table t1 (i int, j bigint) ENGINE=MyISAM;
3284
3108
insert into t1 values (1, 2), (2, 2), (3, 2);
3285
3109
select * from (select min(i) from t1 where j=(select * from (select min(j) from t1) t2)) t3;
3289
CREATE TABLE t1 (i BIGINT UNSIGNED);
3290
INSERT INTO t1 VALUES (10000000000000000000);
3113
CREATE TABLE t1 (i BIGINT) ENGINE=MyISAM;
3114
INSERT INTO t1 VALUES (10000000000000000);
3291
3115
INSERT INTO t1 VALUES (1);
3292
CREATE TABLE t2 (i BIGINT UNSIGNED);
3293
INSERT INTO t2 VALUES (10000000000000000000);
3116
CREATE TABLE t2 (i BIGINT) ENGINE=MyISAM;
3117
INSERT INTO t2 VALUES (10000000000000000);
3294
3118
INSERT INTO t2 VALUES (1);
3295
3119
/* simple test */
3296
3120
SELECT t1.i FROM t1 JOIN t2 ON t1.i = t2.i;
3298
10000000000000000000
3300
3124
/* subquery test */
3301
3125
SELECT t1.i FROM t1 WHERE t1.i = (SELECT MAX(i) FROM t2);
3303
10000000000000000000
3304
3128
/* subquery test with cast*/
3305
SELECT t1.i FROM t1 WHERE t1.i = CAST((SELECT MAX(i) FROM t2) AS UNSIGNED);
3129
SELECT t1.i FROM t1 WHERE t1.i = (SELECT MAX(i) FROM t2);
3307
10000000000000000000
3310
3134
CREATE TABLE t1 (
3311
id bigint(20) unsigned NOT NULL auto_increment,
3135
id bigint NOT NULL auto_increment,
3312
3136
name varchar(255) NOT NULL,
3315
3139
INSERT INTO t1 VALUES
3316
3140
(1, 'Balazs'), (2, 'Joe'), (3, 'Frank');
3317
3141
CREATE TABLE t2 (
3318
id bigint(20) unsigned NOT NULL auto_increment,
3319
mid bigint(20) unsigned NOT NULL,
3142
id bigint NOT NULL auto_increment,
3143
mid bigint NOT NULL,
3320
3144
date date NOT NULL,
3323
3147
INSERT INTO t2 VALUES
3324
3148
(1, 1, '2006-03-30'), (2, 2, '2006-04-06'), (3, 3, '2006-04-13'),
3325
3149
(4, 2, '2006-04-20'), (5, 1, '2006-05-01');
3722
3499
DROP table t1,t2;
3723
CREATE TABLE t1 (a int, b INT, d INT, c CHAR(10) NOT NULL, PRIMARY KEY (a, b));
3500
CREATE TABLE t1 (a int, b INT, d INT, c CHAR(10) NOT NULL, PRIMARY KEY (a, b)) ENGINE=MyISAM;
3724
3501
INSERT INTO t1 VALUES (1,1,0,'a'), (1,2,0,'b'), (1,3,0,'c'), (1,4,0,'d'),
3725
3502
(1,5,0,'e'), (2,1,0,'f'), (2,2,0,'g'), (2,3,0,'h'), (3,4,0,'i'), (3,3,0,'j'),
3726
3503
(3,2,0,'k'), (3,1,0,'l'), (1,9,0,'m'), (1,0,10,'n'), (2,0,5,'o'), (3,0,7,'p');
3928
3700
DROP TABLE t1, t2;
3929
CREATE TABLE t1 (s1 BINARY(5), s2 VARBINARY(5));
3930
INSERT INTO t1 VALUES (0x41,0x41), (0x42,0x42), (0x43,0x43);
3931
SELECT s1, s2 FROM t1 WHERE s2 IN (SELECT s1 FROM t1);
3933
SELECT s1, s2 FROM t1 WHERE (s2, 10) IN (SELECT s1, 10 FROM t1);
3935
CREATE INDEX I1 ON t1 (s1);
3936
CREATE INDEX I2 ON t1 (s2);
3937
SELECT s1, s2 FROM t1 WHERE s2 IN (SELECT s1 FROM t1);
3939
SELECT s1, s2 FROM t1 WHERE (s2, 10) IN (SELECT s1, 10 FROM t1);
3942
INSERT INTO t1 VALUES (0x41,0x41);
3943
SELECT * FROM t1 WHERE s1 = (SELECT s2 FROM t1);
3946
CREATE TABLE t1 (a1 VARBINARY(2) NOT NULL DEFAULT '0', PRIMARY KEY (a1));
3947
CREATE TABLE t2 (a2 BINARY(2) default '0', INDEX (a2));
3948
CREATE TABLE t3 (a3 BINARY(2) default '0');
3949
INSERT INTO t1 VALUES (1),(2),(3),(4);
3950
INSERT INTO t2 VALUES (1),(2),(3);
3951
INSERT INTO t3 VALUES (1),(2),(3);
3952
SELECT LEFT(t2.a2, 1) FROM t2,t3 WHERE t3.a3=t2.a2;
3957
SELECT t1.a1, t1.a1 in (SELECT t2.a2 FROM t2,t3 WHERE t3.a3=t2.a2) FROM t1;
3958
a1 t1.a1 in (SELECT t2.a2 FROM t2,t3 WHERE t3.a3=t2.a2)
3963
DROP TABLE t1,t2,t3;
3964
CREATE TABLE t1 (a1 BINARY(3) PRIMARY KEY, b1 VARBINARY(3));
3965
CREATE TABLE t2 (a2 VARBINARY(3) PRIMARY KEY);
3966
CREATE TABLE t3 (a3 VARBINARY(3) PRIMARY KEY);
3967
INSERT INTO t1 VALUES (1,10), (2,20), (3,30), (4,40);
3968
INSERT INTO t2 VALUES (2), (3), (4), (5);
3969
INSERT INTO t3 VALUES (10), (20), (30);
3970
SELECT LEFT(t1.a1,1) FROM t1,t3 WHERE t1.b1=t3.a3;
3975
SELECT a2 FROM t2 WHERE t2.a2 IN (SELECT t1.a1 FROM t1,t3 WHERE t1.b1=t3.a3);
3977
DROP TABLE t1, t2, t3;
3978
CREATE TABLE t1 (a CHAR(1), b VARCHAR(10));
3701
CREATE TABLE t1 (a CHAR(1), b VARCHAR(10)) ENGINE=MyISAM;
3979
3702
INSERT INTO t1 VALUES ('a', 'aa');
3980
3703
INSERT INTO t1 VALUES ('a', 'aaa');
3981
3704
SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
3984
3707
CREATE INDEX I2 ON t1 (b);
3985
3708
EXPLAIN SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
3986
3709
id select_type table type possible_keys key key_len ref rows Extra
3987
1 PRIMARY t1 index I1 I1 2 NULL 2 Using index; LooseScan
3988
1 PRIMARY t1 ref I2 I2 13 test.t1.a 2 Using index condition
3710
1 PRIMARY t1 index I1 I1 7 NULL 2 Using index; LooseScan
3711
1 PRIMARY t1 ref I2 I2 43 test.t1.a 2 Using where
3989
3712
SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1);
3991
CREATE TABLE t2 (a VARCHAR(1), b VARCHAR(10));
3714
CREATE TABLE t2 (a VARCHAR(1), b VARCHAR(10)) ENGINE=MyISAM;
3992
3715
INSERT INTO t2 SELECT * FROM t1;
3993
3716
CREATE INDEX I1 ON t2 (a);
3994
3717
CREATE INDEX I2 ON t2 (b);
3995
3718
EXPLAIN SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2);
3996
3719
id select_type table type possible_keys key key_len ref rows Extra
3997
1 PRIMARY t2 index I1 I1 4 NULL 2 Using index; LooseScan
3998
1 PRIMARY t2 ref I2 I2 13 test.t2.a 2 Using index condition
3720
1 PRIMARY t2 index I1 I1 7 NULL 2 Using index; LooseScan
3721
1 PRIMARY t2 ref I2 I2 43 test.t2.a 2 Using where
3999
3722
SELECT a,b FROM t2 WHERE b IN (SELECT a FROM t2);
4002
3725
SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
4003
3726
id select_type table type possible_keys key key_len ref rows Extra
4004
1 PRIMARY t1 index I1 I1 2 NULL 2 Using where; Using index; LooseScan
4005
1 PRIMARY t1 ref I2 I2 13 test.t1.a 2 Using index condition
3727
1 PRIMARY t1 index I1 I1 7 NULL 2 Using where; Using index; LooseScan
3728
1 PRIMARY t1 ref I2 I2 43 test.t1.a 2 Using where
4006
3729
SELECT a,b FROM t1 WHERE b IN (SELECT a FROM t1 WHERE LENGTH(a)<500);
4008
3731
DROP TABLE t1,t2;
4009
CREATE TABLE t1(a INT, b INT);
3732
CREATE TABLE t1(a INT, b INT) ENGINE=MyISAM;
4010
3733
INSERT INTO t1 VALUES (1,1), (1,2), (2,3), (2,4);
4012
3735
SELECT a AS out_a, MIN(b) FROM t1
4059
3782
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
4060
3783
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1
4061
Note 1003 select 2 AS "2" from "test"."t1" where exists((select 1 AS "1" from "test"."t2" where ("test"."t1"."a" = "test"."t2"."a")) union (select 1 AS "1" from "test"."t2" where ("test"."t1"."a" = "test"."t2"."a")))
3784
Note 1003 select 2 AS `2` from `test`.`t1` where exists((select 1 AS `1` from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 AS `1` from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)))
4062
3785
DROP TABLE t1,t2;
4063
3786
CREATE TABLE t4 (
4064
3787
f7 varchar(32) collate utf8_bin NOT NULL default '',
4065
3788
f10 varchar(32) collate utf8_bin default NULL,
4068
3791
INSERT INTO t4 VALUES(1,1), (2,null);
4069
3792
CREATE TABLE t2 (
4070
3793
f4 varchar(32) collate utf8_bin NOT NULL default '',
4071
3794
f2 varchar(50) collate utf8_bin default NULL,
4072
3795
f3 varchar(10) collate utf8_bin default NULL,
4073
3796
PRIMARY KEY (f4),
3797
UNIQUE KEY uk1 (f2))
4076
3799
INSERT INTO t2 VALUES(1,1,null), (2,2,null);
4078
3801
f8 varchar(32) collate utf8_bin NOT NULL default '',
4079
3802
f1 varchar(10) collate utf8_bin default NULL,
4080
3803
f9 varchar(32) collate utf8_bin default NULL,
4083
3806
INSERT INTO t1 VALUES (1,'P',1), (2,'P',1), (3,'R',2);
4084
3807
CREATE TABLE t3 (
4085
3808
f6 varchar(32) collate utf8_bin NOT NULL default '',
4086
3809
f5 varchar(50) collate utf8_bin default NULL,
4089
3812
INSERT INTO t3 VALUES (1,null), (2,null);
4091
3814
IF(t1.f1 = 'R', a1.f2, t2.f2) AS a4,
4307
4030
drop table t_out;
4308
4031
drop table t_in;
4309
CREATE TABLE t1 (s1 char(1));
4032
CREATE TABLE t1 (s1 char(1)) ENGINE=MyISAM;
4310
4033
INSERT INTO t1 VALUES ('a');
4311
4034
SELECT * FROM t1 WHERE _utf8'a' = ANY (SELECT s1 FROM t1);
4315
CREATE TABLE t1( a INT );
4038
CREATE TABLE t1( a INT ) ENGINE=MyISAM;
4316
4039
INSERT INTO t1 VALUES (1),(2);
4317
CREATE TABLE t2( a INT, b INT );
4040
CREATE TABLE t2( a INT, b INT ) ENGINE=MyISAM;
4319
4042
FROM (SELECT a INTO @var FROM t1 WHERE a = 2) t1a;
4320
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @var FROM t1 WHERE a = 2) t1a' at line 2
4043
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO @var FROM t1 WHERE a = 2) t1a' at line 2
4322
4045
FROM (SELECT a INTO OUTFILE 'file' FROM t1 WHERE a = 2) t1a;
4323
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' FROM t1 WHERE a = 2) t1a' at line 2
4046
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO OUTFILE 'file' FROM t1 WHERE a = 2) t1a' at line 2
4325
4048
FROM (SELECT a INTO DUMPFILE 'file' FROM t1 WHERE a = 2) t1a;
4326
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' FROM t1 WHERE a = 2) t1a' at line 2
4049
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO DUMPFILE 'file' FROM t1 WHERE a = 2) t1a' at line 2
4327
4050
SELECT * FROM (
4330
4053
SELECT a INTO @var FROM t1 WHERE a = 2
4332
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @var FROM t1 WHERE a = 2
4055
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO @var FROM t1 WHERE a = 2
4333
4056
) t1a' at line 2
4334
4057
SELECT * FROM (
4337
4060
SELECT a INTO OUTFILE 'file' FROM t1 WHERE a = 2
4339
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' FROM t1 WHERE a = 2
4062
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO OUTFILE 'file' FROM t1 WHERE a = 2
4340
4063
) t1a' at line 2
4341
4064
SELECT * FROM (
4344
4067
SELECT a INTO DUMPFILE 'file' FROM t1 WHERE a = 2
4346
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' FROM t1 WHERE a = 2
4069
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO DUMPFILE 'file' FROM t1 WHERE a = 2
4347
4070
) t1a' at line 2
4348
4071
SELECT * FROM (SELECT a FROM t1 WHERE a = 2) t1a;
4376
4099
SELECT * FROM ((SELECT 1 a INTO @a)) t1a;
4377
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @a)) t1a' at line 1
4100
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO @a)) t1a' at line 1
4378
4101
SELECT * FROM ((SELECT 1 a INTO OUTFILE 'file' )) t1a;
4379
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )) t1a' at line 1
4102
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO OUTFILE 'file' )) t1a' at line 1
4380
4103
SELECT * FROM ((SELECT 1 a INTO DUMPFILE 'file' )) t1a;
4381
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )) t1a' at line 1
4104
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO DUMPFILE 'file' )) t1a' at line 1
4382
4105
SELECT * FROM (SELECT 1 a UNION (SELECT 1 a INTO @a)) t1a;
4383
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @a)) t1a' at line 1
4106
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO @a)) t1a' at line 1
4384
4107
SELECT * FROM (SELECT 1 a UNION (SELECT 1 a INTO DUMPFILE 'file' )) t1a;
4385
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )) t1a' at line 1
4108
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO DUMPFILE 'file' )) t1a' at line 1
4386
4109
SELECT * FROM (SELECT 1 a UNION (SELECT 1 a INTO OUTFILE 'file' )) t1a;
4387
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )) t1a' at line 1
4110
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO OUTFILE 'file' )) t1a' at line 1
4388
4111
SELECT * FROM (SELECT 1 a UNION ((SELECT 1 a INTO @a))) t1a;
4389
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @a))) t1a' at line 1
4112
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO @a))) t1a' at line 1
4390
4113
SELECT * FROM (SELECT 1 a UNION ((SELECT 1 a INTO DUMPFILE 'file' ))) t1a;
4391
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' ))) t1a' at line 1
4114
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO DUMPFILE 'file' ))) t1a' at line 1
4392
4115
SELECT * FROM (SELECT 1 a UNION ((SELECT 1 a INTO OUTFILE 'file' ))) t1a;
4393
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' ))) t1a' at line 1
4116
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO OUTFILE 'file' ))) t1a' at line 1
4394
4117
SELECT * FROM (SELECT 1 a ORDER BY a) t1a;
4479
4202
SELECT * FROM t1 WHERE a = ( SELECT 1 INTO @a);
4480
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @a)' at line 1
4203
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO @a)' at line 1
4481
4204
SELECT * FROM t1 WHERE a = ( SELECT 1 INTO OUTFILE 'file' );
4482
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
4205
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
4483
4206
SELECT * FROM t1 WHERE a = ( SELECT 1 INTO DUMPFILE 'file' );
4484
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
4207
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
4485
4208
SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 INTO @a);
4486
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @a)' at line 1
4209
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO @a)' at line 1
4487
4210
SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 INTO OUTFILE 'file' );
4488
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
4211
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
4489
4212
SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 INTO DUMPFILE 'file' );
4490
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
4213
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
4491
4214
SELECT ( SELECT 1 INTO @v );
4492
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @v )' at line 1
4215
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO @v )' at line 1
4493
4216
SELECT ( SELECT 1 INTO OUTFILE 'file' );
4494
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
4217
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
4495
4218
SELECT ( SELECT 1 INTO DUMPFILE 'file' );
4496
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
4219
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
4497
4220
SELECT ( SELECT 1 UNION SELECT 1 INTO @v );
4498
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO @v )' at line 1
4221
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO @v )' at line 1
4499
4222
SELECT ( SELECT 1 UNION SELECT 1 INTO OUTFILE 'file' );
4500
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
4223
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO OUTFILE 'file' )' at line 1
4501
4224
SELECT ( SELECT 1 UNION SELECT 1 INTO DUMPFILE 'file' );
4502
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
4225
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'INTO DUMPFILE 'file' )' at line 1
4503
4226
SELECT ( SELECT a FROM t1 WHERE a = 1 ), a FROM t1;
4504
4227
( SELECT a FROM t1 WHERE a = 1 ) a
4525
4248
((SELECT 1 UNION SELECT 1 UNION SELECT 1))
4527
4250
SELECT * FROM ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
4528
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
4251
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
4529
4252
SELECT * FROM ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
4530
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') UNION SELECT 1 )' at line 1
4253
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near ') UNION SELECT 1 )' at line 1
4531
4254
SELECT * FROM ( SELECT 1 UNION SELECT 1 UNION SELECT 1 ) a;
4534
4257
SELECT * FROM t1 WHERE a = ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
4535
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
4258
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
4536
4259
SELECT * FROM t1 WHERE a = ALL ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
4537
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
4260
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
4538
4261
SELECT * FROM t1 WHERE a = ANY ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
4539
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
4262
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
4540
4263
SELECT * FROM t1 WHERE a IN ( SELECT 1 UNION ( SELECT 1 UNION SELECT 1 ) );
4541
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
4264
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'UNION SELECT 1 ) )' at line 1
4542
4265
SELECT * FROM t1 WHERE a = ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
4543
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 )' at line 1
4266
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'UNION SELECT 1 )' at line 1
4544
4267
SELECT * FROM t1 WHERE a = ALL ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
4545
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) UNION SELECT 1 )' at line 1
4268
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'UNION SELECT 1 ) UNION SELECT 1 )' at line 1
4546
4269
SELECT * FROM t1 WHERE a = ANY ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
4547
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 ) UNION SELECT 1 )' at line 1
4270
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'UNION SELECT 1 ) UNION SELECT 1 )' at line 1
4548
4271
SELECT * FROM t1 WHERE a IN ( ( SELECT 1 UNION SELECT 1 ) UNION SELECT 1 );
4549
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNION SELECT 1 )' at line 1
4272
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'UNION SELECT 1 )' at line 1
4550
4273
SELECT * FROM t1 WHERE a = ( SELECT 1 UNION SELECT 1 UNION SELECT 1 );