Is there a difference between using innerjoin and writing all tables directly in a segment?

Are these two requests separated from each other?

Request 1:

SELECT * FROM Table1, Table2 WHERE Table1.Id = Table2.RefId

Request 2:

SELECT * FROM Table1 INNER JOIN Table2 ON Table1.Id = Table2.RefId

I analyzed both methods, and they clearly gave the same actual execution plans. Do you know cases when using internal joins will work more efficiently. What is the real advantage of using internal joins rather than approaching the “query 1” method?

+3
source share
6 answers

The two operators you provided are functionally equivalent to each other.

The change is due to differences in SQL syntax standards.

SQL, . / SQL.

http://en.wikipedia.org/wiki/SQL

+3

SQL , INNER JOIN ISO-. , where .

+3

, INNER JOIN, OUTER JOIN, CROSS JOIN , .

FROM, WHERE. .

+1

, -, . SQL- . , . 17 , - .

+1

1 , . LEFT Right, . SQL Server syles , .

0

, LEFT OUTER JOIN ON, WHERE. , WHERE, .

When I used Oracle, I used archaic (+) after the joined table (with all conditions, including join conditions in the WHERE clause), because this is what I knew. When we became a SQL Server store, I was forced to use LEFT OUTER JOINs, and I found that they did not work as before until I discovered this behavior. Here is an example:

select  NC.*,
        IsNull(F.STRING_VAL, 'NONE') as USER_ID,
        CO.TOTAL_AMT_ORDERED 
from    customer_order CO
INNER   JOIN VTG_CO_NET_CHANGE NC
ON      NC.CUST_ORDER_ID=CO.ID
LEFT OUTER JOIN USER_DEF_FIELDS F
ON      F.DOCUMENT_ID = CO.ID and
        F.PROGRAM_ID='VMORDENT' and
        F.ID='UDF-0000072' and
        F.DOCUMENT_ID is not null
where   NC.acct_year=2017
0
source

Source: https://habr.com/ru/post/1716694/


All Articles