7 General comprehension, formatting etc.
source | link

SQL Multiple JOINS Interpretation of multiple join order

I have a big problem of using multiple joins in one SQL Statement.

  For example i, I have 10 Tables which they are tbl1,tbl2 tbl2, tbl3,..,tbl10.

  I would like to select some columns from each table from tbl1 till tbl10.

Relations for example are like following:

but if i used JOINS iIf I use joins in between i, I don't know how to use Left,Right Right,etc etc. in the SQL Statementstatement from Prioritypriority aspect. I mean is it with Parenthesis organized with parentheses or like whatsomething else?

ExampleRelations for the SQLexample are like following:   

enter image description here

And my QueryMy query is as following:

SELECT     T1.col1, T2.col2, T3.col3, T4.col1 AS Expr1
FROM         T1   
INNER JOIN T1_T2 ON T1.id = T1_T2.T1_FK 
INNER JOIN T2 ON T1_T2.T2_FK = T2.id 
LEFT JOIN T2_T3 ON T2.id = T2_T3.T2_FK 
INNER JOIN T3 ON T2_T3.T3_FK = T3.id 
LEFT JOIN   T3_T4 ON T3.id = T3_T4.T3_FK 
INNER JOIN T4 ON T3_T4.T4_FK = T4.id

So howHow does SQL Server interprateinterpret the JOINs joins? canCan one represent it like Execution Prioritiesexecution priorities with Paranthesisparentheses?

  I mean: ( (T1 INNER Join T1_T2) INNER JOIN T2 ) LEFT JOIN T2_T3)((T1 INNER Join T1_T2) INNER JOIN T2) LEFT JOIN T2_T3) ?

Thanks alot for feedbacks


Edited for More Explanation:

SQL Multiple JOINS Interpretation order

I have a big problem of using multiple joins in one SQL Statement.

  For example i have 10 Tables which they are tbl1,tbl2, tbl3,..,tbl10.

  I would like to select some columns from each table from tbl1 till tbl10.

Relations for example are like following:

but if i used JOINS i in between i don't know how to use Left,Right,etc in the SQL Statement from Priority aspect. I mean is it with Parenthesis organized or like what?

Example for the SQL:  enter image description here

And my Query is as following

SELECT     T1.col1, T2.col2, T3.col3, T4.col1 AS Expr1
FROM         T1  INNER JOIN T1_T2 ON T1.id = T1_T2.T1_FK 
INNER JOIN T2 ON T1_T2.T2_FK = T2.id 
LEFT JOIN T2_T3 ON T2.id = T2_T3.T2_FK 
INNER JOIN T3 ON T2_T3.T3_FK = T3.id 
LEFT JOIN   T3_T4 ON T3.id = T3_T4.T3_FK 
INNER JOIN T4 ON T3_T4.T4_FK = T4.id

So how does SQL Server interprate the JOINs ? can one represent it like Execution Priorities with Paranthesis?

  I mean: ( (T1 INNER Join T1_T2) INNER JOIN T2 ) LEFT JOIN T2_T3) ?

Thanks alot for feedbacks


Edited for More Explanation:

Interpretation of multiple join order

I have a problem using multiple joins in one SQL Statement. For example, I have 10 Tables which are tbl1, tbl2, tbl3,..,tbl10. I would like to select some columns from each table.

If I use joins in between, I don't know how to use Left, Right, etc. in the SQL statement from priority aspect. I mean is it organized with parentheses or something else?

Relations for example are like following: 

enter image description here

My query is as following:

SELECT T1.col1, T2.col2, T3.col3, T4.col1 AS Expr1
FROM T1   
INNER JOIN T1_T2 ON T1.id = T1_T2.T1_FK 
INNER JOIN T2 ON T1_T2.T2_FK = T2.id 
LEFT JOIN T2_T3 ON T2.id = T2_T3.T2_FK 
INNER JOIN T3 ON T2_T3.T3_FK = T3.id 
LEFT JOIN   T3_T4 ON T3.id = T3_T4.T3_FK 
INNER JOIN T4 ON T3_T4.T4_FK = T4.id

How does SQL Server interpret the joins? Can one represent it like execution priorities with parentheses? I mean: ((T1 INNER Join T1_T2) INNER JOIN T2) LEFT JOIN T2_T3) ?

6 edit tagging
| link
5 edited tags
| link
    Post Reopened by Paul White says GoFundMonica, Colin 't Hart, Max Vernon, Vérace, RLF
4 More Explanation 2 using Image and Query
source | link
    Post Closed as "Needs details or clarity" by ypercubeᵀᴹ, Philᵀᴹ, RolandoMySQLDBA, Max Vernon, Michael Green
3 More Explanation
source | link
2 added 29 characters in body
source | link
1
source | link