1. select E.ename "员工姓名", D.deptno "部门名称"
from emp "e" join -- join是连接
dept "d" on 1 = 1 -- on连接条件
PS: on不能省,有join就必须有on
2. SQL92标准 和 SQL99标准 的区别
select ... from A, B where ... 是SQL92标准
select ... from A join B on ... 是SQL99标准
输出结果是一样的
推荐使用SQL99
PS: 在SQL99标准中,on和where可以做不同的分工,on制定连接条件,where对连接之后临时表的数据进行过滤
eg: select * from emp, dept where emp.deptno = dept.deptno
等价于
select * from emp join dept on emp.deptno = dept.deptno