七、using子句

  • 用来指定进行等值连接的同名字段, 针对自然连接提供的.
  • 同名字段依然不能使用表前缀.

例:

查询20部门员工的姓名, 工资, 部门编号和部门名称

select e.ename, e.sal, deptno, d.dname from emp e natural join dept d where deptno=20;

select e.ename, e.sal, deptno, d.dname from emp e join dept d using (deptno) where deptno=20;

原文地址:https://www.cnblogs.com/qiaoxin11/p/12755866.html