(+)运算符在PL / SQL的where子句中意味着什么?

时间:2011-01-08 07:54:31

标签: sql oracle11g

我有一个SQL查询,如: -

Select Table1.attr1, Table1.attr2, Table2.attr3, Table2.attr4
From Tab1 Tabel1, Tab2 Tabel2
Where Tabel1.Attr = Tabel2.Attr (+)

那么上述意味着什么呢?这是一个正确的外部联接吗?

5 个答案:

答案 0 :(得分:13)

是的,这意味着正确加入。如果声明就像....其中Tabel1.Attr(+)= Tabel2.Attr,它必须保持连接。

答案 1 :(得分:2)

你是对的,+是正确的加入

答案 2 :(得分:2)

这是一个左外部联接。您可以在此处找到使用示例的示例:https://www.techonthenet.com/oracle/joins.php

答案 3 :(得分:1)

我认为这是一个左外部联接(尽管批准的答案表示这是一个右外部联接)。来自Oracle documentation

Using Outer Joins: Examples

SELECT d.department_id, e.last_name
   FROM departments d LEFT OUTER JOIN employees e
   ON d.department_id = e.department_id
   ORDER BY d.department_id;


Users familiar with the traditional Oracle Database outer
joins syntax will recognize the same query in this form:

SELECT d.department_id, e.last_name
   FROM departments d, employees e
   WHERE d.department_id = e.department_id (+)
   ORDER BY d.department_id;

对于RIGHT OUTER JOIN,请将(+)号放在=号之前,例如

SELECT d.department_id, e.last_name
   FROM departments d, employees e
   WHERE d.department_id (+) = e.department_id
   ORDER BY d.department_id;

答案 4 :(得分:0)

Select Table1.attr1, Table1.attr2, Table2.attr3, Table2.attr4
From Tab1 Tabel1, Tab2 Tabel2
Where Tabel1.Attr = Tabel2.Attr (+)

与可识别的语法相同:

Select Table1.attr1, Table1.attr2, Table2.attr3, Table2.attr4 From Tab1 Tabel1
LEFT OUTER JOIN Tab2 Tabel2 on Tabel1.Attr = Tabel2.Attr