In this nested join below in which way is the join evaluated?
Options:
A.
From the left to the right in the order of the tables:
1.
a is joined with b
2.
b is joined with c
B.
From the right to the left in the order of the tables:
1.
b is joined with c.
2.
b is joined with a.
C.
From the top to the bottom in the order of the on conditions
1.
b is joined with c
2.
a is joined with b
D.
From the bottom to the top in the order of the on conditions:
1.
a is joined with b
2.
b is joined with c
Answer:
C
Explanation:
The nested join is evaluated from the top to the bottom in the order of the ON conditions. This means that the join expression is formed by assigning each ON condition to the directly preceding JOIN from left to right. The join expression can be parenthesized implicitly or explicitly to show the order of evaluation. In this case, the implicit parentheses are as follows:
SELECT * FROM (a INNER JOIN (b INNER JOIN c ON b~c = c~c) ON a~b = b~b)
This means that the first join expression is b INNER JOIN c ON b~c = c~c, which joins the columns of tables b and c based on the condition that b~c equals c~c. The second join expression is a INNER JOIN (b INNER JOIN c ON b~c = c~c) ON a~b = b~b, which joins the columns of table a and the result of the first join expression based on the condition that a~b equals b~b. The final result set contains all combinations of rows from tables a, b, and c that satisfy both join conditions.
References: 1: SELECT, FROM JOIN - ABAP Keyword Documentation - SAP Online Help