Oracle database joins [duplicate] - sql

This question already has answers here:
Oracle "(+)" Operator
(4 answers)
Closed 6 years ago.
Suppose there is one condition,
(+) =
i know (+) used in join of column but what does it mean in this condition

The Oracle (+)= syntax is the equivalent for OUTER JOINS.
a.column (+)= b.column
means "retrieve the record from b even if there is no match with a" (RIGH OUTER JOIN)
a.column = b.column (+)
means "retrieve the record from a even if there is no match with b" (LEFT OUTER JOIN)

Related

What is (+) at the end of the query? [duplicate]

This question already has answers here:
Oracle "(+)" Operator
(4 answers)
How to find LEFT OUTER JOIN or RIGHT OUTER JOIN with ORACLE JOIN (+)
(2 answers)
Closed 7 years ago.
I'm quite new to oracle sql and just ran into a query that looks something like this
SELECT some_field
FROM some_table
WHERE some_other_field=some_value(+);
I simplified and annonimized the code, but im curious whats the (+) at the end. I don't remember seeing that in mssql world ever.
It's Oracle old outer join syntax:
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.
http://docs.oracle.com/cd/B19306_01/server.102/b14200/queries006.htm

NUMBER functions (+) [duplicate]

This question already has answers here:
Difference between Oracle's plus (+) notation and ansi JOIN notation?
(8 answers)
Closed 9 years ago.
I'm going through some code and came across a view and was wondering what part of the WHERE statement was doing, it looks like so.
receipt_note.receipt_num(+) = receipt_data.receipt_num
receipt_num is a NUMBER in the table. I just don't know what the (+) would be doing here. Is it adding 1 to that number, like in coding where you would do variable++
(+) is the (old) outer join operator in Oracle. It is specifying an outer join between the receipt_num columns of the receipt_note table and the receipt_data table.
This syntax is obsolete; new queries should use OUTER JOIN instead since it is more readable.

what is (+) syntax in SQL query [duplicate]

This question already has answers here:
Difference between Oracle's plus (+) notation and ansi JOIN notation?
(8 answers)
Closed 9 years ago.
I want to know what the (+) in the below query signify,
select ..
from ..., Fat fat
where prop = fat.prop (+)
Thanks
It is the obsolete outer join symbol.
In Oracle, (+) denotes the "optional" table in the JOIN.
You may check out this for Left and Right Outer Joins.
On a side note:-(Although its obsolete)
The placement of the (+) determines RIGHT or LEFT. If the (+) is on the right, it's a LEFT JOIN and if (+) is on the left, it's a RIGHT JOIN.
For Oracle specifically, indicates a Left Outer Join. Older notation.
Out of date format of outer join. Means only matching rows on the (+) sign side and all rows on the other side. You should use the LEFT/RIGHT OUTER JOIN notation instead.

(+) operator in an oracle query [duplicate]

This question already has answers here:
Oracle "(+)" Operator
(4 answers)
Closed 9 years ago.
The query is as follows
select tbl1.x, tbl2.y
from
tbl1, tbl2
where tbl1.some_column (+) = tbl2.some_column
AND tbl1.some_column2 (+) = 'Y'
What confuses me is this part
AND tbl1.some_column2 (+) = 'Y'
What does it mean?? If I remove the (+) the query returns completely different number of rows. I do understand the application of (+) when there are columns names on the both sides of the =, but what does (+) do when there is a string on the one side of the = ?
It's legacy syntax that Oracle had before they had LEFT OUTER JOIN (or, in this case, probably RIGHT OUTER JOIN).
No need to use it anymore in modern Oracle (at least from 9i, maybe even 8i).
Now you can use the standard SQL join syntax:
SELECT tbl1.x, tbl2.y
FROM tbl1 RIGHT OUTER JOIN tbl2
ON ( tbl1.some_column = tbl2.some_column AND tbl1.some_column2 = 'Y')

What does (+) mean in SQLPlus? [duplicate]

This question already has answers here:
What does (+) do in Oracle SQL?
(4 answers)
Closed 9 years ago.
I just stumbled across a SQL+-Query which uses (+). I've never worked with SQL+ before and I've never seen something like this. I tried to ask Google about it, but I couldn't find anything useful since Google obviously filters the "(+)" and just ignores it...
Example:
[...]
where [...]
AND 16791688 = T7mm.child_fielddef_id (+)
AND T7mm.parent_dbid = T7.dbid (+)
AND T1.dbid <> 0 [...]
it is an Oracle specific shortcut for OUTER JOIN
It makes the join an outer join rather than an inner join:
SELECT
A.*,
B.*
FROM
A,
B
WHERE
A.ID = B.ID(+)
is equivalent to:
SELECT
A.*,
B.*
FROM
A
LEFT JOIN B ON A.ID = B.ID
The (+) notation is the old Oracle syntax for SQL queries. Now it is generally viewed as best practice to use the ANSI standard with the LEFT JOIN keywords instead