oracle的SQL语句中的(+)是干什么用的?
3个回答
展开全部
这个(+)是数据连接的意思,用于表外链接,外链接
举例:
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;
举例:
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;
仁科信息
2024-07-24 广告
2024-07-24 广告
Oracle EBS运维是确保企业资源规划系统稳定、高效运行的关键环节。它涵盖了系统监控、性能优化、故障排查与恢复等多方面内容。通过持续的监控和数据分析,运维团队能够及时发现并解决潜在问题,保障系统的稳定性和安全性。同时,他们还需要与业务部...
点击进入详情页
本回答由仁科信息提供
展开全部
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(+))
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(+))
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
外连接的意思。
请参考原厂手册中的说明:
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.
请参考原厂手册中的说明:
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.
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |