标签:union all nat 标准 sql join from mysql 合并 连接
##合并表
select * from emp
union all
select * from dept;
select * from emp,dept;
##连接查询
select* from emp,dept where emp.deptno = dept.deptno;
##标准写法
select
*
from
emp e
inner join
dept d
on
e.deptno=d.deptno;
###员工表 emp 是主表,去匹配dept
select*from
???emp e
?left join
???dept d
on
???e.deptno = d.deptno
?###部门表是主表,然后去匹配员工表
?select *from
???emp e
?right join
???dept d
???on e.deptno = d.deptno
###自然连接
select
*
from
emp e
natural join
dept d
标签:union all nat 标准 sql join from mysql 合并 连接
原文地址:https://www.cnblogs.com/sxwa/p/14683706.html