Effective resultset structure in case of Inner Join on more than two tables
I was going through this link to see how the effective resultset looks like if we join (Inner/Outer) two tables.
I was just curious to know how the resultset looks like, If we perform Inner/Outer join on more than two tables?
Let's say I've three tables:
1. USERS
2. ADDRESS (Store User's address contains Foreign Key USERS.USER_ID)
3. ITEMS (Contains Items that user sold contains foreign key USERS.USER_ID)
Now If I write a SQL:
SELECT ... FROM USERS users开发者_高级运维 INNER JOIN ADDRESS address ON users.USER_ID = address.USER_ID
INNER JOIN ITEMS items ON users.USER_ID = items.USER_ID WHERE....
How the effective resultset will look like? Whether the DB creates two separate resultset pertaining to each JOIN condition or there will be a single resultset combining all the JOINS? When I say ResultSet, i mean how the effective DB structure looks like (as in the link I've mentioned on top).
Lets me Tell you brief description of the Inner Join And Outer Join. Simply join is for to view columns from two or more tables together.
Inner Join :- The Matched rows Of the Two or more Tables
SELECT ... FROM USERS users INNER JOIN ADDRESS address ON users.USER_ID = address.USER_ID INNER JOIN ITEMS items ON users.USER_ID = items.USER_ID WHERE....
What this Statement says is "SELECT ... FROM USERS users INNER JOIN ADDRESS address ON users.USER_ID = address.USER_ID" gives some rows with the filter specified.
INNER JOIN ITEMS items ON users.USER_ID = items.USER_ID WHERE.... :- statement adds columns of the table [ITEMS] with the specified criteria "users.USER_ID = items.USER_ID"
Outer Join :- Different Row of the table mean no rows matched in table.
Two type of the Outer Join Right Outer :- Not Matched row of the right side table Left Outer :-Not Matched row of the right side table
精彩评论