
What is result when we are joining these two table (INNER, LEFT, RIGHT and CROSS Joins)
INNER JOIN
Matches only where both tables have the same non-NULL value.
Matching values:
Table1 has 1 twice → matches Table2’s 1 once → 2 rows
No other matching values (NULL does not match NULL)
All rows from Table1 + matching rows from Table2
(Unmatched rows from Table1 become NULL on right side)
LEFT JOIN
Breakdown:
| Table1 value | Matching Table2 rows | Count |
| 1 | 1 match × occurs 2 times | 2 |
| 2 | 0 | 1 |
| 5 | 0 | 1 |
| NULL | NULL does not match NULL → 0 | 2 |
LEFT JOIN Result Count = 6
(because Table1 has 6 rows total)
RIGHT JOIN
All rows from Table2 + matching rows from Table1
(Unmatched Table2 rows get NULL on left side)
Breakdown:
| Table2 value | Matching Table1 rows | Count |
| 3 | 0 | 2 |
| 4 | 0 | 2 |
| 1 | Table1 has 1 twice → 2 | 2 |
| NULL | no match | 1 |
Total = 2 + 2 + 2 + 1 = 7
RIGHT JOIN Result Count = 7
CROSS JOIN
All possible combinations of Table1 × Table2
- Table1 rows = 6
- Table2 rows = 6
CROSS JOIN Count = 6 × 6 = 36


Leave a Reply