--disable_warnings
drop table if exists `Ｔ１`;
drop table if exists `Ｔ２`;
drop table if exists `Ｔ３`;
drop table if exists `Ｔ４`;
drop table if exists `Ｔ５`;
drop table if exists `Ｔ６`;
drop table if exists `Ｔ７`;
drop table if exists `Ｔ８`;
drop table if exists `Ｔ９`;
drop table if exists `Ｔ１０`;
drop table if exists `Ｔ１１`;
drop table if exists `Ｔ１２`;
--enable_warnings

#
# Test table JOIN using Japanese characters in utf8
#

SET NAMES utf8;
SET character_set_database = utf8;

CREATE TABLE `Ｔ１a` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ１b` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ２a` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ２b` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ３a` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ３b` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ４a` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ４b` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ５a` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ５b` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ６a` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ６b` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ７a` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ７b` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ８a` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ８b` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ９a` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ９b` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ１０a` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ１０b` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ１１a` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ１１b` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ１２a` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;
CREATE TABLE `Ｔ１２b` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = innodb;

#insert the following data in each table
# jisx0201 hankaku-katakana data
# jisx0208 data
# jisx0212 supplemental character data

INSERT INTO `Ｔ１a` VALUES ('ｱ'),('ｶ'),('ｻ');
INSERT INTO `Ｔ１b` VALUES ('ｱ');
INSERT INTO `Ｔ２a` VALUES ('あ'),('か'),('さ');
INSERT INTO `Ｔ２b` VALUES ('あ');
INSERT INTO `Ｔ３a` VALUES ('龔'),('龖'),('龗');
INSERT INTO `Ｔ３b` VALUES ('龔');
INSERT INTO `Ｔ４a` VALUES ('ｱ'),('ｶ'),('ｻ');
INSERT INTO `Ｔ４b` VALUES ('ｱ');
INSERT INTO `Ｔ５a` VALUES ('あ'),('か'),('さ');
INSERT INTO `Ｔ５b` VALUES ('あ');
INSERT INTO `Ｔ６a` VALUES ('龔'),('龖'),('龗');
INSERT INTO `Ｔ６b` VALUES ('龔');
INSERT INTO `Ｔ７a` VALUES ('ｱ'),('ｶ'),('ｻ');
INSERT INTO `Ｔ７b` VALUES ('ｱ');
INSERT INTO `Ｔ８a` VALUES ('あ'),('か'),('さ');
INSERT INTO `Ｔ８b` VALUES ('あ');
INSERT INTO `Ｔ９a` VALUES ('龔'),('龖'),('龗');
INSERT INTO `Ｔ９b` VALUES ('龔');
INSERT INTO `Ｔ１０a` VALUES ('ｱ'),('ｶ'),('ｻ');
INSERT INTO `Ｔ１０b` VALUES ('ｱ');
INSERT INTO `Ｔ１１a` VALUES ('あ'),('か'),('さ');
INSERT INTO `Ｔ１１b` VALUES ('あ');
INSERT INTO `Ｔ１２a` VALUES ('龔'),('龖'),('龗');
INSERT INTO `Ｔ１２b` VALUES ('龔');

#Test for innodb
SELECT * FROM `Ｔ１a` JOIN `Ｔ１b`;
SELECT * FROM `Ｔ１a` INNER JOIN `Ｔ１b`;
SELECT * FROM `Ｔ１a` JOIN `Ｔ１b` USING (`Ｃ１`);
SELECT * FROM `Ｔ１a` INNER JOIN `Ｔ１b` USING (`Ｃ１`);
SELECT * FROM `Ｔ１a` CROSS JOIN `Ｔ１b`;
SELECT * FROM `Ｔ１a` LEFT JOIN `Ｔ１b` USING (`Ｃ１`);
SELECT * FROM `Ｔ１a` LEFT JOIN `Ｔ１b` ON (`Ｔ１a`.`Ｃ１` = `Ｔ１b`.`Ｃ１`);
SELECT * FROM `Ｔ１b` RIGHT JOIN `Ｔ１a` USING (`Ｃ１`);
SELECT * FROM `Ｔ１b` RIGHT JOIN `Ｔ１a` ON (`Ｔ１a`.`Ｃ１` = `Ｔ１b`.`Ｃ１`);
SELECT * FROM `Ｔ２a` JOIN `Ｔ２b`;
SELECT * FROM `Ｔ２a` INNER JOIN `Ｔ２b`;
SELECT * FROM `Ｔ２a` JOIN `Ｔ２b` USING (`Ｃ１`);
SELECT * FROM `Ｔ２a` INNER JOIN `Ｔ２b` USING (`Ｃ１`);
SELECT * FROM `Ｔ２a` CROSS JOIN `Ｔ２b`;
SELECT * FROM `Ｔ２a` LEFT JOIN `Ｔ２b` USING (`Ｃ１`);
SELECT * FROM `Ｔ２a` LEFT JOIN `Ｔ２b` ON (`Ｔ２a`.`Ｃ１` = `Ｔ２b`.`Ｃ１`);
SELECT * FROM `Ｔ２b` RIGHT JOIN `Ｔ２a` USING (`Ｃ１`);
SELECT * FROM `Ｔ２b` RIGHT JOIN `Ｔ２a` ON (`Ｔ２a`.`Ｃ１` = `Ｔ２b`.`Ｃ１`);
SELECT * FROM `Ｔ３a` JOIN `Ｔ３b`;
SELECT * FROM `Ｔ３a` INNER JOIN `Ｔ３b`;
SELECT * FROM `Ｔ３a` JOIN `Ｔ３b` USING (`Ｃ１`);
SELECT * FROM `Ｔ３a` INNER JOIN `Ｔ３b` USING (`Ｃ１`);
SELECT * FROM `Ｔ３a` CROSS JOIN `Ｔ３b`;
SELECT * FROM `Ｔ３a` LEFT JOIN `Ｔ３b` USING (`Ｃ１`);
SELECT * FROM `Ｔ３a` LEFT JOIN `Ｔ３b` ON (`Ｔ３a`.`Ｃ１` = `Ｔ３b`.`Ｃ１`);
SELECT * FROM `Ｔ３b` RIGHT JOIN `Ｔ３a` USING (`Ｃ１`);
SELECT * FROM `Ｔ３b` RIGHT JOIN `Ｔ３a` ON (`Ｔ３a`.`Ｃ１` = `Ｔ３b`.`Ｃ１`);

#Test for myisam
SELECT * FROM `Ｔ４a` JOIN `Ｔ４b`;
SELECT * FROM `Ｔ４a` INNER JOIN `Ｔ４b`;
SELECT * FROM `Ｔ４a` JOIN `Ｔ４b` USING (`Ｃ１`);
SELECT * FROM `Ｔ４a` INNER JOIN `Ｔ４b` USING (`Ｃ１`);
SELECT * FROM `Ｔ４a` CROSS JOIN `Ｔ４b`;
SELECT * FROM `Ｔ４a` LEFT JOIN `Ｔ４b` USING (`Ｃ１`);
SELECT * FROM `Ｔ４a` LEFT JOIN `Ｔ４b` ON (`Ｔ４a`.`Ｃ１` = `Ｔ４b`.`Ｃ１`);
SELECT * FROM `Ｔ４b` RIGHT JOIN `Ｔ４a` USING (`Ｃ１`);
SELECT * FROM `Ｔ４b` RIGHT JOIN `Ｔ４a` ON (`Ｔ４a`.`Ｃ１` = `Ｔ４b`.`Ｃ１`);
SELECT * FROM `Ｔ５a` JOIN `Ｔ５b`;
SELECT * FROM `Ｔ５a` INNER JOIN `Ｔ５b`;
SELECT * FROM `Ｔ５a` JOIN `Ｔ５b` USING (`Ｃ１`);
SELECT * FROM `Ｔ５a` INNER JOIN `Ｔ５b` USING (`Ｃ１`);
SELECT * FROM `Ｔ５a` CROSS JOIN `Ｔ５b`;
SELECT * FROM `Ｔ５a` LEFT JOIN `Ｔ５b` USING (`Ｃ１`);
SELECT * FROM `Ｔ５a` LEFT JOIN `Ｔ５b` ON (`Ｔ５a`.`Ｃ１` = `Ｔ５b`.`Ｃ１`);
SELECT * FROM `Ｔ５b` RIGHT JOIN `Ｔ５a` USING (`Ｃ１`);
SELECT * FROM `Ｔ５b` RIGHT JOIN `Ｔ５a` ON (`Ｔ５a`.`Ｃ１` = `Ｔ５b`.`Ｃ１`);
SELECT * FROM `Ｔ６a` JOIN `Ｔ６b`;
SELECT * FROM `Ｔ６a` INNER JOIN `Ｔ６b`;
SELECT * FROM `Ｔ６a` JOIN `Ｔ６b` USING (`Ｃ１`);
SELECT * FROM `Ｔ６a` INNER JOIN `Ｔ６b` USING (`Ｃ１`);
SELECT * FROM `Ｔ６a` CROSS JOIN `Ｔ６b`;
SELECT * FROM `Ｔ６a` LEFT JOIN `Ｔ６b` USING (`Ｃ１`);
SELECT * FROM `Ｔ６a` LEFT JOIN `Ｔ６b` ON (`Ｔ６a`.`Ｃ１` = `Ｔ６b`.`Ｃ１`);
SELECT * FROM `Ｔ６b` RIGHT JOIN `Ｔ６a` USING (`Ｃ１`);
SELECT * FROM `Ｔ６b` RIGHT JOIN `Ｔ６a` ON (`Ｔ６a`.`Ｃ１` = `Ｔ６b`.`Ｃ１`);

#Test for heap
SELECT * FROM `Ｔ７a` JOIN `Ｔ７b`;
SELECT * FROM `Ｔ７a` INNER JOIN `Ｔ７b`;
SELECT * FROM `Ｔ７a` JOIN `Ｔ７b` USING (`Ｃ１`);
SELECT * FROM `Ｔ７a` INNER JOIN `Ｔ７b` USING (`Ｃ１`);
SELECT * FROM `Ｔ７a` CROSS JOIN `Ｔ７b`;
SELECT * FROM `Ｔ７a` LEFT JOIN `Ｔ７b` USING (`Ｃ１`);
SELECT * FROM `Ｔ７a` LEFT JOIN `Ｔ７b` ON (`Ｔ７a`.`Ｃ１` = `Ｔ７b`.`Ｃ１`);
SELECT * FROM `Ｔ７b` RIGHT JOIN `Ｔ７a` USING (`Ｃ１`);
SELECT * FROM `Ｔ７b` RIGHT JOIN `Ｔ７a` ON (`Ｔ７a`.`Ｃ１` = `Ｔ７b`.`Ｃ１`);
SELECT * FROM `Ｔ８a` JOIN `Ｔ８b`;
SELECT * FROM `Ｔ８a` INNER JOIN `Ｔ８b`;
SELECT * FROM `Ｔ８a` JOIN `Ｔ８b` USING (`Ｃ１`);
SELECT * FROM `Ｔ８a` INNER JOIN `Ｔ８b` USING (`Ｃ１`);
SELECT * FROM `Ｔ８a` CROSS JOIN `Ｔ８b`;
SELECT * FROM `Ｔ８a` LEFT JOIN `Ｔ８b` USING (`Ｃ１`);
SELECT * FROM `Ｔ８a` LEFT JOIN `Ｔ８b` ON (`Ｔ８a`.`Ｃ１` = `Ｔ８b`.`Ｃ１`);
SELECT * FROM `Ｔ８b` RIGHT JOIN `Ｔ８a` USING (`Ｃ１`);
SELECT * FROM `Ｔ８b` RIGHT JOIN `Ｔ８a` ON (`Ｔ８a`.`Ｃ１` = `Ｔ８b`.`Ｃ１`);
SELECT * FROM `Ｔ９a` JOIN `Ｔ９b`;
SELECT * FROM `Ｔ９a` INNER JOIN `Ｔ９b`;
SELECT * FROM `Ｔ９a` JOIN `Ｔ９b` USING (`Ｃ１`);
SELECT * FROM `Ｔ９a` INNER JOIN `Ｔ９b` USING (`Ｃ１`);
SELECT * FROM `Ｔ９a` CROSS JOIN `Ｔ９b`;
SELECT * FROM `Ｔ９a` LEFT JOIN `Ｔ９b` USING (`Ｃ１`);
SELECT * FROM `Ｔ９a` LEFT JOIN `Ｔ９b` ON (`Ｔ９a`.`Ｃ１` = `Ｔ９b`.`Ｃ１`);
SELECT * FROM `Ｔ９b` RIGHT JOIN `Ｔ９a` USING (`Ｃ１`);
SELECT * FROM `Ｔ９b` RIGHT JOIN `Ｔ９a` ON (`Ｔ９a`.`Ｃ１` = `Ｔ９b`.`Ｃ１`);

#Test for heap
SELECT * FROM `Ｔ１０a` JOIN `Ｔ１０b`;
SELECT * FROM `Ｔ１０a` INNER JOIN `Ｔ１０b`;
SELECT * FROM `Ｔ１０a` JOIN `Ｔ１０b` USING (`Ｃ１`);
SELECT * FROM `Ｔ１０a` INNER JOIN `Ｔ１０b` USING (`Ｃ１`);
SELECT * FROM `Ｔ１０a` CROSS JOIN `Ｔ１０b`;
SELECT * FROM `Ｔ１０a` LEFT JOIN `Ｔ１０b` USING (`Ｃ１`);
SELECT * FROM `Ｔ１０a` LEFT JOIN `Ｔ１０b` ON (`Ｔ１０a`.`Ｃ１` = `Ｔ１０b`.`Ｃ１`);
SELECT * FROM `Ｔ１０b` RIGHT JOIN `Ｔ１０a` USING (`Ｃ１`);
SELECT * FROM `Ｔ１０b` RIGHT JOIN `Ｔ１０a` ON (`Ｔ１０a`.`Ｃ１` = `Ｔ１０b`.`Ｃ１`);
SELECT * FROM `Ｔ１１a` JOIN `Ｔ１１b`;
SELECT * FROM `Ｔ１１a` INNER JOIN `Ｔ１１b`;
SELECT * FROM `Ｔ１１a` JOIN `Ｔ１１b` USING (`Ｃ１`);
SELECT * FROM `Ｔ１１a` INNER JOIN `Ｔ１１b` USING (`Ｃ１`);
SELECT * FROM `Ｔ１１a` CROSS JOIN `Ｔ１１b`;
SELECT * FROM `Ｔ１１a` LEFT JOIN `Ｔ１１b` USING (`Ｃ１`);
SELECT * FROM `Ｔ１１a` LEFT JOIN `Ｔ１１b` ON (`Ｔ１１a`.`Ｃ１` = `Ｔ１１b`.`Ｃ１`);
SELECT * FROM `Ｔ１１b` RIGHT JOIN `Ｔ１１a` USING (`Ｃ１`);
SELECT * FROM `Ｔ１１b` RIGHT JOIN `Ｔ１１a` ON (`Ｔ１１a`.`Ｃ１` = `Ｔ１１b`.`Ｃ１`);
SELECT * FROM `Ｔ１２a` JOIN `Ｔ１２b`;
SELECT * FROM `Ｔ１２a` INNER JOIN `Ｔ１２b`;
SELECT * FROM `Ｔ１２a` JOIN `Ｔ１２b` USING (`Ｃ１`);
SELECT * FROM `Ｔ１２a` INNER JOIN `Ｔ１２b` USING (`Ｃ１`);
SELECT * FROM `Ｔ１２a` CROSS JOIN `Ｔ１２b`;
SELECT * FROM `Ｔ１２a` LEFT JOIN `Ｔ１２b` USING (`Ｃ１`);
SELECT * FROM `Ｔ１２a` LEFT JOIN `Ｔ１２b` ON (`Ｔ１２a`.`Ｃ１` = `Ｔ１２b`.`Ｃ１`);
SELECT * FROM `Ｔ１２b` RIGHT JOIN `Ｔ１２a` USING (`Ｃ１`);
SELECT * FROM `Ｔ１２b` RIGHT JOIN `Ｔ１２a` ON (`Ｔ１２a`.`Ｃ１` = `Ｔ１２b`.`Ｃ１`);

DROP TABLE `Ｔ１a`;
DROP TABLE `Ｔ１b`;
DROP TABLE `Ｔ２a`;
DROP TABLE `Ｔ２b`;
DROP TABLE `Ｔ３a`;
DROP TABLE `Ｔ３b`;
DROP TABLE `Ｔ４a`;
DROP TABLE `Ｔ４b`;
DROP TABLE `Ｔ５a`;
DROP TABLE `Ｔ５b`;
DROP TABLE `Ｔ６a`;
DROP TABLE `Ｔ６b`;
DROP TABLE `Ｔ７a`;
DROP TABLE `Ｔ７b`;
DROP TABLE `Ｔ８a`;
DROP TABLE `Ｔ８b`;
DROP TABLE `Ｔ９a`;
DROP TABLE `Ｔ９b`;
DROP TABLE `Ｔ１０a`;
DROP TABLE `Ｔ１０b`;
DROP TABLE `Ｔ１１a`;
DROP TABLE `Ｔ１１b`;
DROP TABLE `Ｔ１２a`;
DROP TABLE `Ｔ１２b`;
