what the mening of (+) in BETWEEN function [duplicate] - sql

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:

Related

What are the differences between JOIN statement and one without it? [duplicate]

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

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 a (+) sign mean in an Oracle SQL WHERE clause? [duplicate]

This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
Oracle: What does (+) do in a WHERE clause?
Consider the simplified SQL query below, in an Oracle database environment (although I'm not sure that it's Oracle-specific):
SELECT
t0.foo, t1.bar
FROM
FIRST_TABLE t0, SECOND_TABLE t1
WHERE
t0.ID (+) = t1.ID;
What is that (+) notation for in the WHERE clause? I'm sorry if this is an ignorant newbie question, but it's been extremely difficult to search for on Google or StackOverflow... because even when using quote marks, search engines see a '+' sign and seem to want to treat it as some kind of a logical directive.
This is an Oracle-specific notation for an outer join. It means that it will include all rows from t1, and use NULLS in the t0 columns if there is no corresponding row in t0.
In standard SQL one would write:
SELECT t0.foo, t1.bar
FROM FIRST_TABLE t0
RIGHT OUTER JOIN SECOND_TABLE t1;
Oracle recommends not to use those joins anymore if your version supports ANSI joins (LEFT/RIGHT JOIN) :
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 […]