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 `Ｔ９`;
SET NAMES ujis;
SET character_set_database = ujis;
CREATE TABLE `Ｔ１` (`Ｃ１` char(1), INDEX(`Ｃ１`)) DEFAULT CHARSET = ujis engine = innodb;
CREATE TABLE `Ｔ２` (`Ｃ１` char(1), INDEX(`Ｃ１`)) DEFAULT CHARSET = ujis engine = innodb;
CREATE TABLE `Ｔ３` (`Ｃ１` char(1), INDEX(`Ｃ１`)) DEFAULT CHARSET = ujis engine = innodb;
INSERT INTO `Ｔ１` VALUES('ｱ'),('ｱ'),('あ'),('あ'),('龔'),('龔');
INSERT INTO `Ｔ２` VALUES('ｲ'),('ｲ'),('い'),('い'),('龖'),('龖');
INSERT INTO `Ｔ３` VALUES('ｳ'),('ｳ'),('う'),('う'),('龗'),('龗');
SELECT * FROM `Ｔ１` UNION DISTINCT SELECT * FROM `Ｔ２` ORDER BY `Ｃ１`;
Ｃ１
ｱ
ｲ
龔
龖
あ
い
SELECT * FROM `Ｔ１` UNION ALL SELECT * FROM `Ｔ２` ORDER BY `Ｃ１`;
Ｃ１
ｱ
ｱ
ｲ
ｲ
龔
龔
龖
龖
あ
あ
い
い
(SELECT * FROM `Ｔ１`) UNION (SELECT * FROM `Ｔ２`) UNION (SELECT 'う') ORDER BY `Ｃ１`;
Ｃ１
ｱ
ｲ
龔
龖
あ
い
う
(SELECT 'う' AS `Ｃ１`) UNION (SELECT * FROM `Ｔ１`) UNION (SELECT * FROM `Ｔ２`) ORDER BY `Ｃ１`;
Ｃ１
ｱ
ｲ
龔
龖
あ
い
う
SELECT `Ｃ１`, COUNT(*) FROM `Ｔ１` GROUP BY `Ｃ１` UNION
SELECT `Ｃ１`, COUNT(*) FROM `Ｔ２` GROUP BY `Ｃ１` ORDER BY `Ｃ１`;
Ｃ１	COUNT(*)
ｱ	2
ｲ	2
龔	2
龖	2
あ	2
い	2
SELECT * FROM `Ｔ１` UNION DISTINCT
SELECT * FROM `Ｔ２` UNION ALL
SELECT * FROM `Ｔ３` ORDER BY `Ｃ１`;
Ｃ１
ｱ
ｲ
ｳ
ｳ
龔
龖
龗
龗
あ
い
う
う
SELECT * FROM `Ｔ１` UNION ALL
SELECT * FROM `Ｔ２` UNION DISTINCT
SELECT * FROM `Ｔ３` ORDER BY `Ｃ１`;
Ｃ１
ｱ
ｲ
ｳ
龔
龖
龗
あ
い
う
SELECT * FROM `Ｔ１` UNION SELECT REPEAT(`Ｃ１`,5) FROM `Ｔ２` ORDER BY `Ｃ１`;
Ｃ１
ｱ
ｲｲｲｲｲ
龔
龖龖龖龖龖
あ
いいいいい
DROP TABLE `Ｔ１` ;
DROP TABLE `Ｔ２` ;
DROP TABLE `Ｔ３` ;
CREATE TABLE `Ｔ１` (`Ｃ１` char(1), INDEX(`Ｃ１`)) DEFAULT CHARSET = ujis engine = MYISAM;
CREATE TABLE `Ｔ２` (`Ｃ１` char(1), INDEX(`Ｃ１`)) DEFAULT CHARSET = ujis engine = MYISAM;
CREATE TABLE `Ｔ３` (`Ｃ１` char(1), INDEX(`Ｃ１`)) DEFAULT CHARSET = ujis engine = MYISAM;
INSERT INTO `Ｔ１` VALUES('ｱ'),('ｱ'),('あ'),('あ'),('龔'),('龔');
INSERT INTO `Ｔ２` VALUES('ｲ'),('ｲ'),('い'),('い'),('龖'),('龖');
INSERT INTO `Ｔ３` VALUES('ｳ'),('ｳ'),('う'),('う'),('龗'),('龗');
SELECT * FROM `Ｔ１` UNION DISTINCT SELECT * FROM `Ｔ２` ORDER BY `Ｃ１`;
Ｃ１
ｱ
ｲ
龔
龖
あ
い
SELECT * FROM `Ｔ１` UNION ALL SELECT * FROM `Ｔ２` ORDER BY `Ｃ１`;
Ｃ１
ｱ
ｱ
ｲ
ｲ
龔
龔
龖
龖
あ
あ
い
い
(SELECT * FROM `Ｔ１`) UNION (SELECT * FROM `Ｔ２`) UNION (SELECT 'う') ORDER BY `Ｃ１`;
Ｃ１
ｱ
ｲ
龔
龖
あ
い
う
(SELECT 'う' AS `Ｃ１`) UNION (SELECT * FROM `Ｔ１`) UNION (SELECT * FROM `Ｔ２`) ORDER BY `Ｃ１`;
Ｃ１
ｱ
ｲ
龔
龖
あ
い
う
SELECT `Ｃ１`, COUNT(*) FROM `Ｔ１` GROUP BY `Ｃ１` UNION
SELECT `Ｃ１`, COUNT(*) FROM `Ｔ２` GROUP BY `Ｃ１` ORDER BY `Ｃ１`;
Ｃ１	COUNT(*)
ｱ	2
ｲ	2
龔	2
龖	2
あ	2
い	2
SELECT * FROM `Ｔ１` UNION DISTINCT
SELECT * FROM `Ｔ２` UNION ALL
SELECT * FROM `Ｔ３` ORDER BY `Ｃ１`;
Ｃ１
ｱ
ｲ
ｳ
ｳ
龔
龖
龗
龗
あ
い
う
う
SELECT * FROM `Ｔ１` UNION ALL
SELECT * FROM `Ｔ２` UNION DISTINCT
SELECT * FROM `Ｔ３` ORDER BY `Ｃ１`;
Ｃ１
ｱ
ｲ
ｳ
龔
龖
龗
あ
い
う
SELECT * FROM `Ｔ１` UNION SELECT REPEAT(`Ｃ１`,5) FROM `Ｔ２` ORDER BY `Ｃ１`;
Ｃ１
ｱ
ｲｲｲｲｲ
龔
龖龖龖龖龖
あ
いいいいい
DROP TABLE `Ｔ１` ;
DROP TABLE `Ｔ２` ;
DROP TABLE `Ｔ３` ;
CREATE TABLE `Ｔ１` (`Ｃ１` char(1), INDEX(`Ｃ１`)) DEFAULT CHARSET = ujis engine = MEMORY;
CREATE TABLE `Ｔ２` (`Ｃ１` char(1), INDEX(`Ｃ１`)) DEFAULT CHARSET = ujis engine = MEMORY;
CREATE TABLE `Ｔ３` (`Ｃ１` char(1), INDEX(`Ｃ１`)) DEFAULT CHARSET = ujis engine = MEMORY;
INSERT INTO `Ｔ１` VALUES('ｱ'),('ｱ'),('あ'),('あ'),('龔'),('龔');
INSERT INTO `Ｔ２` VALUES('ｲ'),('ｲ'),('い'),('い'),('龖'),('龖');
INSERT INTO `Ｔ３` VALUES('ｳ'),('ｳ'),('う'),('う'),('龗'),('龗');
SELECT * FROM `Ｔ１` UNION DISTINCT SELECT * FROM `Ｔ２` ORDER BY `Ｃ１`;
Ｃ１
ｱ
ｲ
龔
龖
あ
い
SELECT * FROM `Ｔ１` UNION ALL SELECT * FROM `Ｔ２` ORDER BY `Ｃ１`;
Ｃ１
ｱ
ｱ
ｲ
ｲ
龔
龔
龖
龖
あ
あ
い
い
(SELECT * FROM `Ｔ１`) UNION (SELECT * FROM `Ｔ２`) UNION (SELECT 'う') ORDER BY `Ｃ１`;
Ｃ１
ｱ
ｲ
龔
龖
あ
い
う
(SELECT 'う' AS `Ｃ１`) UNION (SELECT * FROM `Ｔ１`) UNION (SELECT * FROM `Ｔ２`) ORDER BY `Ｃ１`;
Ｃ１
ｱ
ｲ
龔
龖
あ
い
う
SELECT `Ｃ１`, COUNT(*) FROM `Ｔ１` GROUP BY `Ｃ１` UNION
SELECT `Ｃ１`, COUNT(*) FROM `Ｔ２` GROUP BY `Ｃ１` ORDER BY `Ｃ１`;
Ｃ１	COUNT(*)
ｱ	2
ｲ	2
龔	2
龖	2
あ	2
い	2
SELECT * FROM `Ｔ１` UNION DISTINCT
SELECT * FROM `Ｔ２` UNION ALL
SELECT * FROM `Ｔ３` ORDER BY `Ｃ１`;
Ｃ１
ｱ
ｲ
ｳ
ｳ
龔
龖
龗
龗
あ
い
う
う
SELECT * FROM `Ｔ１` UNION ALL
SELECT * FROM `Ｔ２` UNION DISTINCT
SELECT * FROM `Ｔ３` ORDER BY `Ｃ１`;
Ｃ１
ｱ
ｲ
ｳ
龔
龖
龗
あ
い
う
SELECT * FROM `Ｔ１` UNION SELECT REPEAT(`Ｃ１`,5) FROM `Ｔ２` ORDER BY `Ｃ１`;
Ｃ１
ｱ
ｲｲｲｲｲ
龔
龖龖龖龖龖
あ
いいいいい
DROP TABLE `Ｔ１` ;
DROP TABLE `Ｔ２` ;
DROP TABLE `Ｔ３` ;
CREATE TABLE `Ｔ１` (`Ｃ１` char(1), INDEX(`Ｃ１`)) DEFAULT CHARSET = ujis engine = InnoDB;
CREATE TABLE `Ｔ２` (`Ｃ１` char(1), INDEX(`Ｃ１`)) DEFAULT CHARSET = ujis engine = MyISAM;
INSERT INTO `Ｔ１` VALUES('ｱ'),('ｱ'),('あ'),('あ'),('龔'),('龔');
INSERT INTO `Ｔ２` VALUES('ｲ'),('ｲ'),('い'),('い'),('龖'),('龖');
SELECT * FROM `Ｔ１` UNION DISTINCT SELECT * FROM `Ｔ２` ORDER BY `Ｃ１`;
Ｃ１
ｱ
ｲ
龔
龖
あ
い
SELECT * FROM `Ｔ１` UNION ALL SELECT * FROM `Ｔ２` ORDER BY `Ｃ１`;
Ｃ１
ｱ
ｱ
ｲ
ｲ
龔
龔
龖
龖
あ
あ
い
い
DROP TABLE `Ｔ１`;
DROP TABLE `Ｔ２`;
