Different number of rows return based on different type of joins

Consider the following tables:

Table: Employees

EmployeeId Name
1 Alice
2 Bob
3 Carol

Table: Tasks

TaskId EmployeeId TaskName
101 1 Task A
102 2 Task B
103 2 Task C
104 4 Task D

Results of Different Joins

1. INNER JOIN

An INNER JOIN returns only the rows where there is a match between the two tables.

EmployeeName TaskName
Alice Task A
Bob Task B
Bob Task C

Number of Rows: 3

2. LEFT JOIN

A LEFT JOIN returns all rows from the left table, with matching rows from the right table. If there is no match, the result is NULL on the right side.

EmployeeName TaskName
Alice Task A
Bob Task B
Bob Task C
Carol NULL

Number of Rows: 4

3. RIGHT JOIN

A RIGHT JOIN returns all rows from the right table, with matching rows from the left table. If there is no match, the result is NULL on the left side.

EmployeeName TaskName
Alice Task A
Bob Task B
Bob Task C
NULL Task D

Number of Rows: 4

4. FULL JOIN

A FULL JOIN returns all rows when there is a match in one of the tables. It combines the results of both LEFT JOIN and RIGHT JOIN.

EmployeeName TaskName
Alice Task A
Bob Task B
Bob Task C
Carol NULL
NULL Task D

Number of Rows: 5