时间:2021-07-01 10:21:17 帮助过:24人阅读
1 DROP TABLE IF EXISTS `w2`; 2 CREATE TABLE `w2` ( 3 `wbid` int(11) NOT NULL AUTO_INCREMENT, 4 `wb1` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL, 5 `wb2` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL, 6 PRIMARY KEY (`wbid`) 7 ) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; 8 9 -- ---------------------------- 10 -- Records of w2 11 -- ---------------------------- 12 INSERT INTO `w2` VALUES (‘1‘, ‘w2-1‘, ‘2‘); 13 INSERT INTO `w2` VALUES (‘2‘, ‘w2-2‘, ‘2‘);
1 SELECT * FROM w1 LEFT JOIN w2 ON w1.wa2=w2.wb2 2 SELECT * FROM w1 LEFT JOIN w2 ON w2.wb2=w1.wa2 3 4 SELECT * FROM w2 RIGHT JOIN w1 ON w1.wa2=w2.wb2 5 SELECT * FROM w2 RIGHT JOIN w1 ON w2.wb2=w1.wa2 6 7 8 SELECT * FROM w2 LEFT JOIN w1 ON w1.wa2=w2.wb2 9 SELECT * FROM w2 LEFT JOIN w1 ON w2.wb2=w1.wa2 10 11 SELECT * FROM w1 RIGHT JOIN w2 ON w1.wa2=w2.wb2 12 SELECT * FROM w1 RIGHT JOIN w2 ON w2.wb2=w1.wa2 13 14 15 SELECT * FROM w1 INNER JOIN w2 ON w1.wa2=w2.wb2 16 SELECT * FROM w1 INNER JOIN w2 ON w2.wb2=w1.wa2 17 SELECT * FROM w1 CROSS JOIN w2 ON w1.wa2=w2.wb2 18 SELECT * FROM w1 CROSS JOIN w2 ON w2.wb2=w1.wa2 19 20 SELECT * FROM w2 INNER JOIN w1 ON w1.wa2=w2.wb2 21 SELECT * FROM w2 INNER JOIN w1 ON w2.wb2=w1.wa2 22 SELECT * FROM w2 CROSS JOIN w1 ON w1.wa2=w2.wb2 23 SELECT * FROM w2 CROSS JOIN w1 ON w2.wb2=w1.wa2
不要让mysql犹豫不决
标签:engine select key sam mysql charset utf8 efault val