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.
Related
This question already has answers here:
LEFT JOIN vs. LEFT OUTER JOIN in SQL Server
(12 answers)
Closed 5 years ago.
LEFT JOIN and LEFT OUTER JOIN works exactly the same way.
Which means the keyword OUTER has no effect or it is optional.
Why do we include a keyword which has no effect in execution?
It is optional, I always assumed that it was originally there as its more descriptive.
However it doesn't actually mean anything as a join is either inner, left, right or full - so the outer key word can be inferred to be relevant for all but inner joins.
This question already has answers here:
Oracle: What does `(+)` do in a WHERE clause?
(4 answers)
Closed 5 years ago.
Recently I observed the following syntax:
AND TRUNC (SYSDATE) + 1 BETWEEN a(+) AND b(+)
I know that the (+) sign is used to address left or right join in conditions like:
and a = b(+)
... but I have no idea what it means in the BETWEEN function.
Can someone explain, please, or better give an example using BETWEEN function?
Thank you,
The Oracle docs says:
Oracle recommends that you use the FROM clause OUTER JOIN syntax
rather than the Oracle join operator. Outer join queries that use the
Oracle join operator (+) are subject to the following rules and
restrictions, which do not apply to the FROM clause OUTER JOIN syntax:
This question already has answers here:
Explicit vs implicit SQL joins
(12 answers)
Closed 6 years ago.
I am currently learning SQL. I am trying to create Views using Oracle SQL Developer. I came across the JOIN statement but I do not understand why do we need JOIN. According to W3School, the purpose of JOIN is to join multiple rows together. I can do that without the expression JOIN (refer to the following code blocks, both of them produce the same view/table). So what is the purpose of JOIN?
With INNER JOIN:
SELECT
Acc.Cust_Id,
Cus.Address,
Acc.Avail_Balance
FROM
Account Acc
INNER JOIN
Customer Cus
ON
Acc.Cust_Id = Cus.CUST_ID
Without INNER JOIN:
SELECT
Acc.Cust_Id,
Cus.Address,
Acc.Avail_Balance
FROM
Account Acc,
Customer Cus
WHERE
Acc.Cust_Id = Cus.CUST_ID
The two queries are the same, except the 1st one ANSI-92 SQL syntax and the and other is older SQL syntax which didn't incorporate the join clause. They should produce exactly the same internal query plan, although you may like to check.
check This link
ANSI vs. non-ANSI SQL JOIN syntax
This question already has answers here:
Inner join vs Where
(19 answers)
SQL JOIN - WHERE clause vs. ON clause
(22 answers)
INNER JOIN ON vs WHERE clause
(12 answers)
Closed 9 years ago.
When doing an SQL query,
is there any significant (or any at all) difference in performance between 'WHERE' and 'ON'?
I know there is a significant difference in the resulting set between the two for a LEFT or RIGHT JOIN.
What about an INNER JOIN?
Is there any drawback to using 'ON' for each of my selects rather than 'WHERE' at the end?
Performance wise, they should be the same. However, see this article for an opinion of an industry veteran regarding the readability and maintenace-friendliness.
While the old-style joins still work, you can't do an outer join anymore
Execution plans for both are identical. Many people prefer the use of ON though.
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
When or why would you use a right outer join instead of left?
What ever the functionality i get with left outer join i can get it by interchanging table names.Then, what is the need for having two outer joins ( left and right) ? If there is any specific need can some body explain with an example ?
Why do we use >= when < does the same thing?
Mostly it's a convenience thing.
They're the same thing, use whichever makes more sense to your mind when reading the query.