An INNER JOIN returns all the common rows between both of the tables (Table A and Table B).
As per the below example, the JOIN selects all the Items and their Companies from both the tables as long as the COMPANY ID matches. The company IDs 19 and 20 (for the items Nuttela and Cup-cakes) from Table A do not have company entries in Table B. Similarly the company IDs 21 and 22 from Table B are not associated with any Items from Table A. Hence these Items will not be shown in the result.
One to One Use case:
Requirement : Merge daily plan data with actual daily sales data of various employees and create plan vs actual data.
Table – A : Contains Daily sales of various employees
Table – B : Contains Daily Target of various employees
As per the joining condition, the employee Boddy Jones’s target on 12th Sep 2020 is not defined in Table B. Similarly, there is no sales entry for the employee Boddy Jones on 19th Aug 2020 in Table A. Hence these records are not displayed in the result.
Many to One Use case:
Requirement: Merge Employee wise Daily Sales with Employee wise Monthly Plan Data and create Employee wise Daily Actual vs Plan Data .
Table – A : Employee wise Daily Sales
Table – B : Employee wise Monthly Target
As per the below example, the employee ‘Jason Mehta’s’ target for Sep 2020 is not defined in Table B. Similarly there are no sales entries for the employees Jason Mehta in Aug 2020 and David Brown for Sep 2020 in Table A. Hence these rows are not displayed in the Result.
One to Many Use case:
Requirement : Merge Employee wise Monthly Target with Employee wise Daily Sales and create Employee wise Plan vs Actual Data.
Table – A : Employee wise Monthly Target
Table – B : Employee wise Daily Sales
As per the joining condition, the employee David Brown and Jason Mehta do not have any sales entries for the month Sep 2020 and Aug 2020 respectively in Table B. Similarly the employee Jason Mehta’s Target for the month of Sep 2020 is not defined in Table A. Hence these rows will not be displayed in the result.
Many to Many Use case:
Requirement : Get customer wise product sales and vice versa from the sales transaction table, customer master
and product master.
Table – A : Product Master Table which contains Product Id and Product Name.
Table – B : Customer Master Table which contains Customer Id and Customer Name.
Table – C : Transaction Sales Table which contains Product ID, Customer ID and Sales.
Product ID P5 and Customer ID C4 are not defined in the master tables. Hence, this record is not included in the