Basic types of join
- INNER JOIN
- OUTER JOIN
- LEFT OUTER JOIN
- RIGHT OUTER JOIN
- FULL OUTER JOIN
- CROSS JOIN
TableA Structure
TableA Data
TableB Structure
TableB Data
INNER JOIN
A Join return tose data which are match condition applied in ON clause of the query so it display data which is common in bot TableA and TableB as you see in below image
SELECT select_column_list FROM TableA INNER JOIN TableB ON TableA.ID = TableB.TableA_IdExample:
LEFT OUTER JOIN
A Join return all rows which match condition of ON clause as well as all row form left table i.e TableA. Un-match row of right table i.e TableB replace by the NULL value which you can see in below image of output window
SELECT select_column_list FROM TableA LEFT OUTER JOIN TableB ON TableA.ID = TableB.TableA_IdExample :
RIGHT OUTER JOIN
A Join return all rows which match condition of ON clause as well as all row form right table i.e TableB. Un-match row of left table i.e TableA replace by the NULL value which you can see in below image of output window
SELECT select_column_list FROM TableA RIGHT OUTER JOIN TableB ON TableA.ID = TableB.TableA_IdExample:
FULL OUTER JOIN
A Join return all rows which match condition of ON clause as well as all row form both table. Un-match row of left table i.e TableA replace by the NULL value and Un-match row of right table i.e TableB replace by the
Null value, which you can see in below image of output window
Null value, which you can see in below image of output window
SELECT select_column_list FROM TableA FULL OUTER JOIN TableB ON TableA.ID = TableB.TableA_IdExample:
CROSS JOIN
A join wose result set includes one row for eac possible pairin of rows form te two tables.
SELECT select_column_list FROM TableA CROSS JOIN TableB
No comments:
Post a Comment