--source include/have_utf8.inc
--source include/have_innodb.inc
--disable_warnings
drop table if exists `Ｔ１a`;
drop table if exists `Ｔ１b`;
drop table if exists `Ｔ２a`;
drop table if exists `Ｔ２b`;
drop table if exists `Ｔ３a`;
drop table if exists `Ｔ３b`;
drop table if exists `Ｔ４a`;
drop table if exists `Ｔ４b`;
drop table if exists `Ｔ５a`;
drop table if exists `Ｔ５b`;
drop table if exists `Ｔ６a`;
drop table if exists `Ｔ６b`;
drop table if exists `Ｔ７a`;
drop table if exists `Ｔ７b`;
drop table if exists `Ｔ８a`;
drop table if exists `Ｔ８b`;
drop table if exists `Ｔ９a`;
drop table if exists `Ｔ９b`;
--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 = MyISAM;
CREATE TABLE `Ｔ４b` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MyISAM;
CREATE TABLE `Ｔ５a` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MyISAM;
CREATE TABLE `Ｔ５b` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MyISAM;
CREATE TABLE `Ｔ６a` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MyISAM;
CREATE TABLE `Ｔ６b` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MyISAM;
CREATE TABLE `Ｔ７a` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
CREATE TABLE `Ｔ７b` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
CREATE TABLE `Ｔ８a` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
CREATE TABLE `Ｔ８b` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
CREATE TABLE `Ｔ９a` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;
CREATE TABLE `Ｔ９b` (`Ｃ１` char(1) PRIMARY KEY) DEFAULT CHARSET = utf8 engine = MEMORY;

#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 ('龔');

#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 MEMORY
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`;
