2
drop table if exists `T1`;
3
drop table if exists `T2`;
4
drop table if exists `T3`;
5
drop table if exists `T4`;
6
drop table if exists `T5`;
7
drop table if exists `T6`;
8
drop table if exists `T7`;
9
drop table if exists `T8`;
10
drop table if exists `T9`;
11
drop table if exists `T10`;
12
drop table if exists `T11`;
13
drop table if exists `T12`;
17
# Test subquery using Japanese characters in utf8 encoding
21
SET character_set_database = utf8;
23
CREATE TABLE `T1a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
24
CREATE TABLE `T1b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
25
CREATE TABLE `T2a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
26
CREATE TABLE `T2b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
27
CREATE TABLE `T3a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
28
CREATE TABLE `T3b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
29
CREATE TABLE `T4a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = myisam;
30
CREATE TABLE `T4b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = myisam;
31
CREATE TABLE `T5a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = myisam;
32
CREATE TABLE `T5b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = myisam;
33
CREATE TABLE `T6a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = myisam;
34
CREATE TABLE `T6b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = myisam;
35
CREATE TABLE `T7a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = heap;
36
CREATE TABLE `T7b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = heap;
37
CREATE TABLE `T8a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = heap;
38
CREATE TABLE `T8b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = heap;
39
CREATE TABLE `T9a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = heap;
40
CREATE TABLE `T9b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = heap;
41
CREATE TABLE `T10a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = heap;
42
CREATE TABLE `T10b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = heap;
43
CREATE TABLE `T11a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = heap;
44
CREATE TABLE `T11b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = heap;
45
CREATE TABLE `T12a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = heap;
46
CREATE TABLE `T12b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = heap;
48
#insert the following data in each table
49
# jisx0201 hankaku-katakana data
51
# jisx0212 supplemental character data
53
INSERT INTO `T1a` VALUES ('ア'),('カ'),('サ');
54
INSERT INTO `T1b` VALUES ('ア');
55
INSERT INTO `T2a` VALUES ('あ'),('か'),('さ');
56
INSERT INTO `T2b` VALUES ('あ');
57
INSERT INTO `T3a` VALUES ('龔'),('龖'),('龗');
58
INSERT INTO `T3b` VALUES ('龔');
59
INSERT INTO `T4a` VALUES ('ア'),('カ'),('サ');
60
INSERT INTO `T4b` VALUES ('ア');
61
INSERT INTO `T5a` VALUES ('あ'),('か'),('さ');
62
INSERT INTO `T5b` VALUES ('あ');
63
INSERT INTO `T6a` VALUES ('龔'),('龖'),('龗');
64
INSERT INTO `T6b` VALUES ('龔');
65
INSERT INTO `T7a` VALUES ('ア'),('カ'),('サ');
66
INSERT INTO `T7b` VALUES ('ア');
67
INSERT INTO `T8a` VALUES ('あ'),('か'),('さ');
68
INSERT INTO `T8b` VALUES ('あ');
69
INSERT INTO `T9a` VALUES ('龔'),('龖'),('龗');
70
INSERT INTO `T9b` VALUES ('龔');
71
INSERT INTO `T10a` VALUES ('ア'),('カ'),('サ');
72
INSERT INTO `T10b` VALUES ('ア');
73
INSERT INTO `T11a` VALUES ('あ'),('か'),('さ');
74
INSERT INTO `T11b` VALUES ('あ');
75
INSERT INTO `T12a` VALUES ('龔'),('龖'),('龗');
76
INSERT INTO `T12b` VALUES ('龔');
79
SELECT `C1` FROM `T1a` WHERE `C1` IN (SELECT `C1` FROM `T1b`);
80
SELECT `C1` FROM `T1a` WHERE EXISTS (SELECT `C1` FROM `T1b` WHERE `T1a`.`C1` = `T1b`.`C1`);
81
SELECT `C1` FROM `T1a` WHERE NOT EXISTS (SELECT `C1` FROM `T1b` WHERE `T1a`.`C1` = `T1b`.`C1`);
82
SELECT `C1` FROM `T2a` WHERE `C1` IN (SELECT `C1` FROM `T2b`);
83
SELECT `C1` FROM `T2a` WHERE EXISTS (SELECT `C1` FROM `T2b` WHERE `T2a`.`C1` = `T2b`.`C1`);
84
SELECT `C1` FROM `T2a` WHERE NOT EXISTS (SELECT `C1` FROM `T2b` WHERE `T2a`.`C1` = `T2b`.`C1`);
85
SELECT `C1` FROM `T3a` WHERE `C1` IN (SELECT `C1` FROM `T3b`);
86
SELECT `C1` FROM `T3a` WHERE EXISTS (SELECT `C1` FROM `T3b` WHERE `T3a`.`C1` = `T3b`.`C1`);
87
SELECT `C1` FROM `T3a` WHERE NOT EXISTS (SELECT `C1` FROM `T3b` WHERE `T3a`.`C1` = `T3b`.`C1`);
88
SELECT `C1` FROM `T4a` WHERE `C1` IN (SELECT `C1` FROM `T4b`);
89
SELECT `C1` FROM `T4a` WHERE EXISTS (SELECT `C1` FROM `T4b` WHERE `T4a`.`C1` = `T4b`.`C1`);
90
SELECT `C1` FROM `T4a` WHERE NOT EXISTS (SELECT `C1` FROM `T4b` WHERE `T4a`.`C1` = `T4b`.`C1`);
91
SELECT `C1` FROM `T5a` WHERE `C1` IN (SELECT `C1` FROM `T5b`);
92
SELECT `C1` FROM `T5a` WHERE EXISTS (SELECT `C1` FROM `T5b` WHERE `T5a`.`C1` = `T5b`.`C1`);
93
SELECT `C1` FROM `T5a` WHERE NOT EXISTS (SELECT `C1` FROM `T5b` WHERE `T5a`.`C1` = `T5b`.`C1`);
94
SELECT `C1` FROM `T6a` WHERE `C1` IN (SELECT `C1` FROM `T6b`);
95
SELECT `C1` FROM `T6a` WHERE EXISTS (SELECT `C1` FROM `T6b` WHERE `T6a`.`C1` = `T6b`.`C1`);
96
SELECT `C1` FROM `T6a` WHERE NOT EXISTS (SELECT `C1` FROM `T6b` WHERE `T6a`.`C1` = `T6b`.`C1`);
97
SELECT `C1` FROM `T7a` WHERE `C1` IN (SELECT `C1` FROM `T7b`);
98
SELECT `C1` FROM `T7a` WHERE EXISTS (SELECT `C1` FROM `T7b` WHERE `T7a`.`C1` = `T7b`.`C1`);
99
SELECT `C1` FROM `T7a` WHERE NOT EXISTS (SELECT `C1` FROM `T7b` WHERE `T7a`.`C1` = `T7b`.`C1`);
100
SELECT `C1` FROM `T8a` WHERE `C1` IN (SELECT `C1` FROM `T8b`);
101
SELECT `C1` FROM `T8a` WHERE EXISTS (SELECT `C1` FROM `T8b` WHERE `T8a`.`C1` = `T8b`.`C1`);
102
SELECT `C1` FROM `T8a` WHERE NOT EXISTS (SELECT `C1` FROM `T8b` WHERE `T8a`.`C1` = `T8b`.`C1`);
103
SELECT `C1` FROM `T9a` WHERE `C1` IN (SELECT `C1` FROM `T9b`);
104
SELECT `C1` FROM `T9a` WHERE EXISTS (SELECT `C1` FROM `T9b` WHERE `T9a`.`C1` = `T9b`.`C1`);
105
SELECT `C1` FROM `T9a` WHERE NOT EXISTS (SELECT `C1` FROM `T9b` WHERE `T9a`.`C1` = `T9b`.`C1`);
106
SELECT `C1` FROM `T10a` WHERE `C1` IN (SELECT `C1` FROM `T10b`);
107
SELECT `C1` FROM `T10a` WHERE EXISTS (SELECT `C1` FROM `T10b` WHERE `T10a`.`C1` = `T10b`.`C1`);
108
SELECT `C1` FROM `T10a` WHERE NOT EXISTS (SELECT `C1` FROM `T10b` WHERE `T10a`.`C1` = `T10b`.`C1`);
109
SELECT `C1` FROM `T11a` WHERE `C1` IN (SELECT `C1` FROM `T11b`);
110
SELECT `C1` FROM `T11a` WHERE EXISTS (SELECT `C1` FROM `T11b` WHERE `T11a`.`C1` = `T11b`.`C1`);
111
SELECT `C1` FROM `T11a` WHERE NOT EXISTS (SELECT `C1` FROM `T11b` WHERE `T11a`.`C1` = `T11b`.`C1`);
112
SELECT `C1` FROM `T12a` WHERE `C1` IN (SELECT `C1` FROM `T12b`);
113
SELECT `C1` FROM `T12a` WHERE EXISTS (SELECT `C1` FROM `T12b` WHERE `T12a`.`C1` = `T12b`.`C1`);
114
SELECT `C1` FROM `T12a` WHERE NOT EXISTS (SELECT `C1` FROM `T12b` WHERE `T12a`.`C1` = `T12b`.`C1`);