mysql left join join right
时间:2021-07-01 10:21:17
帮助过:3人阅读
my.name = java.name;
+------+------+
| name | name |
+------+------+
| blue | blue |
+------+------+
1 row in set (0.00 sec)查询结果
2.left join 外联查询 已左表为主表 左表的信息全部会全部查出来 右表的信息只有相关联的才能查出来 剩下的查询结果为null 效率慢一点
select * from java left join mysql as my on java.name=my.name;
+-------+------+
| name | name |
+-------+------+
| java1 | NULL |
| java2 | NULL |
| blue | blue |
+-------+------+
3 rows in set (0.00 sec) 查询结果
3.rignt join 正好与left join 相反
mysql left join join right
标签: