1
by brian
clean slate |
1 |
--disable_warnings
|
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`; |
|
14 |
--enable_warnings
|
|
15 |
||
16 |
#
|
|
17 |
# Test table JOIN using Japanese characters in utf8 |
|
18 |
#
|
|
19 |
||
20 |
SET NAMES utf8; |
|
21 |
SET character_set_database = utf8; |
|
22 |
||
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 = innodb; |
|
30 |
CREATE TABLE `T4b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb; |
|
31 |
CREATE TABLE `T5a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb; |
|
32 |
CREATE TABLE `T5b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb; |
|
33 |
CREATE TABLE `T6a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb; |
|
34 |
CREATE TABLE `T6b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb; |
|
35 |
CREATE TABLE `T7a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb; |
|
36 |
CREATE TABLE `T7b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb; |
|
37 |
CREATE TABLE `T8a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb; |
|
38 |
CREATE TABLE `T8b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb; |
|
39 |
CREATE TABLE `T9a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb; |
|
40 |
CREATE TABLE `T9b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb; |
|
41 |
CREATE TABLE `T10a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb; |
|
42 |
CREATE TABLE `T10b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb; |
|
43 |
CREATE TABLE `T11a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb; |
|
44 |
CREATE TABLE `T11b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb; |
|
45 |
CREATE TABLE `T12a` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb; |
|
46 |
CREATE TABLE `T12b` (`C1` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb; |
|
47 |
||
48 |
#insert the following data in each table |
|
49 |
# jisx0201 hankaku-katakana data |
|
50 |
# jisx0208 data |
|
51 |
# jisx0212 supplemental character data |
|
52 |
||
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 ('龔'); |
|
77 |
||
78 |
#Test for innodb |
|
79 |
SELECT * FROM `T1a` JOIN `T1b`; |
|
80 |
SELECT * FROM `T1a` INNER JOIN `T1b`; |
|
81 |
SELECT * FROM `T1a` JOIN `T1b` USING (`C1`); |
|
82 |
SELECT * FROM `T1a` INNER JOIN `T1b` USING (`C1`); |
|
83 |
SELECT * FROM `T1a` CROSS JOIN `T1b`; |
|
84 |
SELECT * FROM `T1a` LEFT JOIN `T1b` USING (`C1`); |
|
85 |
SELECT * FROM `T1a` LEFT JOIN `T1b` ON (`T1a`.`C1` = `T1b`.`C1`); |
|
86 |
SELECT * FROM `T1b` RIGHT JOIN `T1a` USING (`C1`); |
|
87 |
SELECT * FROM `T1b` RIGHT JOIN `T1a` ON (`T1a`.`C1` = `T1b`.`C1`); |
|
88 |
SELECT * FROM `T2a` JOIN `T2b`; |
|
89 |
SELECT * FROM `T2a` INNER JOIN `T2b`; |
|
90 |
SELECT * FROM `T2a` JOIN `T2b` USING (`C1`); |
|
91 |
SELECT * FROM `T2a` INNER JOIN `T2b` USING (`C1`); |
|
92 |
SELECT * FROM `T2a` CROSS JOIN `T2b`; |
|
93 |
SELECT * FROM `T2a` LEFT JOIN `T2b` USING (`C1`); |
|
94 |
SELECT * FROM `T2a` LEFT JOIN `T2b` ON (`T2a`.`C1` = `T2b`.`C1`); |
|
95 |
SELECT * FROM `T2b` RIGHT JOIN `T2a` USING (`C1`); |
|
96 |
SELECT * FROM `T2b` RIGHT JOIN `T2a` ON (`T2a`.`C1` = `T2b`.`C1`); |
|
97 |
SELECT * FROM `T3a` JOIN `T3b`; |
|
98 |
SELECT * FROM `T3a` INNER JOIN `T3b`; |
|
99 |
SELECT * FROM `T3a` JOIN `T3b` USING (`C1`); |
|
100 |
SELECT * FROM `T3a` INNER JOIN `T3b` USING (`C1`); |
|
101 |
SELECT * FROM `T3a` CROSS JOIN `T3b`; |
|
102 |
SELECT * FROM `T3a` LEFT JOIN `T3b` USING (`C1`); |
|
103 |
SELECT * FROM `T3a` LEFT JOIN `T3b` ON (`T3a`.`C1` = `T3b`.`C1`); |
|
104 |
SELECT * FROM `T3b` RIGHT JOIN `T3a` USING (`C1`); |
|
105 |
SELECT * FROM `T3b` RIGHT JOIN `T3a` ON (`T3a`.`C1` = `T3b`.`C1`); |
|
106 |
||
107 |
#Test for myisam |
|
108 |
SELECT * FROM `T4a` JOIN `T4b`; |
|
109 |
SELECT * FROM `T4a` INNER JOIN `T4b`; |
|
110 |
SELECT * FROM `T4a` JOIN `T4b` USING (`C1`); |
|
111 |
SELECT * FROM `T4a` INNER JOIN `T4b` USING (`C1`); |
|
112 |
SELECT * FROM `T4a` CROSS JOIN `T4b`; |
|
113 |
SELECT * FROM `T4a` LEFT JOIN `T4b` USING (`C1`); |
|
114 |
SELECT * FROM `T4a` LEFT JOIN `T4b` ON (`T4a`.`C1` = `T4b`.`C1`); |
|
115 |
SELECT * FROM `T4b` RIGHT JOIN `T4a` USING (`C1`); |
|
116 |
SELECT * FROM `T4b` RIGHT JOIN `T4a` ON (`T4a`.`C1` = `T4b`.`C1`); |
|
117 |
SELECT * FROM `T5a` JOIN `T5b`; |
|
118 |
SELECT * FROM `T5a` INNER JOIN `T5b`; |
|
119 |
SELECT * FROM `T5a` JOIN `T5b` USING (`C1`); |
|
120 |
SELECT * FROM `T5a` INNER JOIN `T5b` USING (`C1`); |
|
121 |
SELECT * FROM `T5a` CROSS JOIN `T5b`; |
|
122 |
SELECT * FROM `T5a` LEFT JOIN `T5b` USING (`C1`); |
|
123 |
SELECT * FROM `T5a` LEFT JOIN `T5b` ON (`T5a`.`C1` = `T5b`.`C1`); |
|
124 |
SELECT * FROM `T5b` RIGHT JOIN `T5a` USING (`C1`); |
|
125 |
SELECT * FROM `T5b` RIGHT JOIN `T5a` ON (`T5a`.`C1` = `T5b`.`C1`); |
|
126 |
SELECT * FROM `T6a` JOIN `T6b`; |
|
127 |
SELECT * FROM `T6a` INNER JOIN `T6b`; |
|
128 |
SELECT * FROM `T6a` JOIN `T6b` USING (`C1`); |
|
129 |
SELECT * FROM `T6a` INNER JOIN `T6b` USING (`C1`); |
|
130 |
SELECT * FROM `T6a` CROSS JOIN `T6b`; |
|
131 |
SELECT * FROM `T6a` LEFT JOIN `T6b` USING (`C1`); |
|
132 |
SELECT * FROM `T6a` LEFT JOIN `T6b` ON (`T6a`.`C1` = `T6b`.`C1`); |
|
133 |
SELECT * FROM `T6b` RIGHT JOIN `T6a` USING (`C1`); |
|
134 |
SELECT * FROM `T6b` RIGHT JOIN `T6a` ON (`T6a`.`C1` = `T6b`.`C1`); |
|
135 |
||
136 |
#Test for heap |
|
137 |
SELECT * FROM `T7a` JOIN `T7b`; |
|
138 |
SELECT * FROM `T7a` INNER JOIN `T7b`; |
|
139 |
SELECT * FROM `T7a` JOIN `T7b` USING (`C1`); |
|
140 |
SELECT * FROM `T7a` INNER JOIN `T7b` USING (`C1`); |
|
141 |
SELECT * FROM `T7a` CROSS JOIN `T7b`; |
|
142 |
SELECT * FROM `T7a` LEFT JOIN `T7b` USING (`C1`); |
|
143 |
SELECT * FROM `T7a` LEFT JOIN `T7b` ON (`T7a`.`C1` = `T7b`.`C1`); |
|
144 |
SELECT * FROM `T7b` RIGHT JOIN `T7a` USING (`C1`); |
|
145 |
SELECT * FROM `T7b` RIGHT JOIN `T7a` ON (`T7a`.`C1` = `T7b`.`C1`); |
|
146 |
SELECT * FROM `T8a` JOIN `T8b`; |
|
147 |
SELECT * FROM `T8a` INNER JOIN `T8b`; |
|
148 |
SELECT * FROM `T8a` JOIN `T8b` USING (`C1`); |
|
149 |
SELECT * FROM `T8a` INNER JOIN `T8b` USING (`C1`); |
|
150 |
SELECT * FROM `T8a` CROSS JOIN `T8b`; |
|
151 |
SELECT * FROM `T8a` LEFT JOIN `T8b` USING (`C1`); |
|
152 |
SELECT * FROM `T8a` LEFT JOIN `T8b` ON (`T8a`.`C1` = `T8b`.`C1`); |
|
153 |
SELECT * FROM `T8b` RIGHT JOIN `T8a` USING (`C1`); |
|
154 |
SELECT * FROM `T8b` RIGHT JOIN `T8a` ON (`T8a`.`C1` = `T8b`.`C1`); |
|
155 |
SELECT * FROM `T9a` JOIN `T9b`; |
|
156 |
SELECT * FROM `T9a` INNER JOIN `T9b`; |
|
157 |
SELECT * FROM `T9a` JOIN `T9b` USING (`C1`); |
|
158 |
SELECT * FROM `T9a` INNER JOIN `T9b` USING (`C1`); |
|
159 |
SELECT * FROM `T9a` CROSS JOIN `T9b`; |
|
160 |
SELECT * FROM `T9a` LEFT JOIN `T9b` USING (`C1`); |
|
161 |
SELECT * FROM `T9a` LEFT JOIN `T9b` ON (`T9a`.`C1` = `T9b`.`C1`); |
|
162 |
SELECT * FROM `T9b` RIGHT JOIN `T9a` USING (`C1`); |
|
163 |
SELECT * FROM `T9b` RIGHT JOIN `T9a` ON (`T9a`.`C1` = `T9b`.`C1`); |
|
164 |
||
165 |
#Test for heap |
|
166 |
SELECT * FROM `T10a` JOIN `T10b`; |
|
167 |
SELECT * FROM `T10a` INNER JOIN `T10b`; |
|
168 |
SELECT * FROM `T10a` JOIN `T10b` USING (`C1`); |
|
169 |
SELECT * FROM `T10a` INNER JOIN `T10b` USING (`C1`); |
|
170 |
SELECT * FROM `T10a` CROSS JOIN `T10b`; |
|
171 |
SELECT * FROM `T10a` LEFT JOIN `T10b` USING (`C1`); |
|
172 |
SELECT * FROM `T10a` LEFT JOIN `T10b` ON (`T10a`.`C1` = `T10b`.`C1`); |
|
173 |
SELECT * FROM `T10b` RIGHT JOIN `T10a` USING (`C1`); |
|
174 |
SELECT * FROM `T10b` RIGHT JOIN `T10a` ON (`T10a`.`C1` = `T10b`.`C1`); |
|
175 |
SELECT * FROM `T11a` JOIN `T11b`; |
|
176 |
SELECT * FROM `T11a` INNER JOIN `T11b`; |
|
177 |
SELECT * FROM `T11a` JOIN `T11b` USING (`C1`); |
|
178 |
SELECT * FROM `T11a` INNER JOIN `T11b` USING (`C1`); |
|
179 |
SELECT * FROM `T11a` CROSS JOIN `T11b`; |
|
180 |
SELECT * FROM `T11a` LEFT JOIN `T11b` USING (`C1`); |
|
181 |
SELECT * FROM `T11a` LEFT JOIN `T11b` ON (`T11a`.`C1` = `T11b`.`C1`); |
|
182 |
SELECT * FROM `T11b` RIGHT JOIN `T11a` USING (`C1`); |
|
183 |
SELECT * FROM `T11b` RIGHT JOIN `T11a` ON (`T11a`.`C1` = `T11b`.`C1`); |
|
184 |
SELECT * FROM `T12a` JOIN `T12b`; |
|
185 |
SELECT * FROM `T12a` INNER JOIN `T12b`; |
|
186 |
SELECT * FROM `T12a` JOIN `T12b` USING (`C1`); |
|
187 |
SELECT * FROM `T12a` INNER JOIN `T12b` USING (`C1`); |
|
188 |
SELECT * FROM `T12a` CROSS JOIN `T12b`; |
|
189 |
SELECT * FROM `T12a` LEFT JOIN `T12b` USING (`C1`); |
|
190 |
SELECT * FROM `T12a` LEFT JOIN `T12b` ON (`T12a`.`C1` = `T12b`.`C1`); |
|
191 |
SELECT * FROM `T12b` RIGHT JOIN `T12a` USING (`C1`); |
|
192 |
SELECT * FROM `T12b` RIGHT JOIN `T12a` ON (`T12a`.`C1` = `T12b`.`C1`); |
|
193 |
||
194 |
DROP TABLE `T1a`; |
|
195 |
DROP TABLE `T1b`; |
|
196 |
DROP TABLE `T2a`; |
|
197 |
DROP TABLE `T2b`; |
|
198 |
DROP TABLE `T3a`; |
|
199 |
DROP TABLE `T3b`; |
|
200 |
DROP TABLE `T4a`; |
|
201 |
DROP TABLE `T4b`; |
|
202 |
DROP TABLE `T5a`; |
|
203 |
DROP TABLE `T5b`; |
|
204 |
DROP TABLE `T6a`; |
|
205 |
DROP TABLE `T6b`; |
|
206 |
DROP TABLE `T7a`; |
|
207 |
DROP TABLE `T7b`; |
|
208 |
DROP TABLE `T8a`; |
|
209 |
DROP TABLE `T8b`; |
|
210 |
DROP TABLE `T9a`; |
|
211 |
DROP TABLE `T9b`; |
|
212 |
DROP TABLE `T10a`; |
|
213 |
DROP TABLE `T10b`; |
|
214 |
DROP TABLE `T11a`; |
|
215 |
DROP TABLE `T11b`; |
|
216 |
DROP TABLE `T12a`; |
|
217 |
DROP TABLE `T12b`; |