Oracle内连接和外连接有什么区别啊

来源:百度知道 编辑:UC知道 时间:2024/05/21 06:48:22

就我知道的,举几个例子吧:

1.Equijoin Examples

This equijoin returns the name and job of each employee and the number and name of the department in which the employee works:

SELECT ename, job, dept.deptno, dname
FROM emp, dept
WHERE emp.deptno = dept.deptno;

2.Self Join Example

The following query uses a self join to return the name of each employee along with the name of the employee's manager:

SELECT e1.ename||' works for '||e2.ename
"Employees and their Managers"
FROM emp e1, emp e2 WHERE e1.mgr = e2.empno;

3.Outer Join Examples
This query uses an outer join to extend the results of the Equijoin example above:

SELECT ename, job, dept.deptno, dname
FROM emp, dept
WHERE emp.deptno (+) = dept.deptno;

上例中,即使emp中没有与dept中匹配的记录,该查询
也会把emp表中的记录全部返回,具体结果你自己执行一下就
知道啦.

建议你去看Oracle在线文档吧,上面这些都是从