Everyday SQL (6)

这是我工作遇到的问题,从别的组里要来了一堆SQL code,大概是四五年前在那工作的人写的,感觉是old style,之前从没见过,贴出来给大家。

Q: What’s the meaning of (+) in SQL queries (Oracle)?

 

A: It’s Oracle’s synonym for OUTER JOIN.

Example:

 

SELECT *

FROM a, b

WHERE b.id(+) = a.id

 

gives the same result as

 

SELECT *

FROM a

LEFT OUTER JOIN b

ON b.id = a.id

 

Or we can say (+) indicates this side gets nulls when no match can be found.

Be the first to comment

Leave a Reply

Your email address will not be published.


*