当前位置:Gxlcms > mysql > INNERLEFTRIGHTJOIN语句_MySQL

INNERLEFTRIGHTJOIN语句_MySQL

时间:2021-07-01 10:21:17 帮助过:13人阅读

bitsCN.com
INNER LEFT RIGHT JOIN语句 Sql代码 CREATE TABLE `a` ( `a1` VARCHAR(10) DEFAULT NULL, `b1` VARCHAR(10) DEFAULT NULL, `c1` VARCHAR(10) DEFAULT NULL ) ENGINE=INNODB DEFAULT CHARSET=utf8 CREATE TABLE `b` ( `a2` VARCHAR(10) DEFAULT NULL, `b2` VARCHAR(10) DEFAULT NULL ) ENGINE=INNODB DEFAULT CHARSET=utf8 创建出表,表内数据如下: SQL语句执行结果图片在语句的下方 Sql代码 #inner join SELECT A.*,B.* FROM a INNER JOIN B ON a.a1=b.a2 Sql代码 #left join SELECT A.*,B.* FROM a LEFT OUTER JOIN b ON a.a1 = b.a2 Sql代码 #right join SELECT A.*,B.* FROM a RIGHT OUTER JOIN b ON a.a1 = b.a2 Sql代码 #full outer join union SELECT A.*,B.* FROM a LEFT OUTER JOIN b ON a.a1 = b.a2 UNION SELECT A.*,B.* FROM a RIGHT OUTER JOIN b ON a.a1 = b.a2 Sql代码 SELECT A.*, B.* FROM A,B Sql代码 SELECT A.*,B.* FROM a JOIN b ON a.a1 = b.a2 默认是inner join

bitsCN.com

人气教程排行