oracle的SQL语句中的(+)是干什么用的?

 我来答
云计算懂管理的小司
2010-09-19 · TA获得超过1145个赞
知道小有建树答主
回答量:756
采纳率:100%
帮助的人:441万
展开全部
这个(+)是数据连接的意思,用于表外链接,外链接
举例:
select a.ENAME,b.ENAME from emp a,emp b where a.MGR=b.empno(+);--外连接 内表或俩表比较有+端强制显示空结果
select a.ENAME as ben,b.ENAME as shangji from emp a,emp b where a.MGR=b.empno(+) and a.hiredate<b.hiredate;
select a.dname,b.* from dept a,emp b where a.deptno=b.deptno(+) order by b.empno;
xhxyes111
2010-09-19 · TA获得超过2900个赞
知道小有建树答主
回答量:278
采纳率:100%
帮助的人:383万
展开全部
oracle特有的左外联书写方式,当然你也可以用传统的通用的左外联,比如给你举个例子
SELECT s.name AS 姓名,g.grade AS 分数,c.cid AS 课程名
FROM tbl_student s LEFT OUTER JOIN tbl_grade g ON s.StudentId=g.sid LEFT OUTER JOIN tbl_class c ON g.cid=c.ClassId
它跟下面等价
SELECT s.name AS 姓名,g.grade AS 分数,c.classname AS 课程名
FROM tbl_student s,tbl_grade g,tbl_class c
WHERE (s.StudentId=g.sid(+)) AND (g.cid=c.ClassId(+))
本回答被提问者和网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
神装法师
2010-09-19 · TA获得超过790个赞
知道小有建树答主
回答量:154
采纳率:0%
帮助的人:320万
展开全部
外连接的意思。
请参考原厂手册中的说明:

Outer Joins
An outer join extends the result of a simple join. An outer join returns all rows that satisfy the join condition and also returns some or all of those rows from one table for which no rows from the other satisfy the join condition.

1、To write a query that performs an outer join of tables A and B and returns all rows from A (a left outer join), use the LEFT [OUTER] JOIN syntax in the FROM clause, or apply the outer join operator (+) to all columns of B in the join condition in the WHERE clause. For all rows in A that have no matching rows in B, Oracle Database returns null for any select list expressions containing columns of B.

2、To write a query that performs an outer join of tables A and B and returns all rows from B (a right outer join), use the RIGHT [OUTER] JOIN syntax in the FROM clause, or apply the outer join operator (+) to all columns of A in the join condition in the WHERE clause. For all rows in B that have no matching rows in A, Oracle returns null for any select list expressions containing columns of A.

3、To write a query that performs an outer join and returns all rows from A and B, extended with nulls if they do not satisfy the join condition (a full outer join), use the FULL [OUTER] JOIN syntax in the FROM clause.
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式