80% of Candidates Got This Join Concept Wrong In Interviews
Understand the concept about joins and crack your interviews

Importance of Joins!
Join is a very important concept for Data Scientists/Data Analysts as they perform at least one join whenever they manipulate and transform the data. Getting the join concept wrong, might lead to an unexpected outcome and a lot of rework downstream. So, when I evaluate experienced candidates for a data science role, I always focus on this concept, and I have found that almost 70% of the candidates get the concept wrong.
Question on Joins!
The following are the join questions on which I usually evaluate the candidates. The idea is to understand if they really understand the complete concept or not.
If we have 2 data tables (shown below), where one table contains the ‘Salary’ of the employee and another table contains the ‘Designation’ of the employee, then what will be the output of performing an inner join, left join, right join, and outer join on ‘Name’ column?

Try to find the output of the inner joins, left join, right join, and Outer join, and check whether you get it right or not.
Result of Inner Join!
The inner join will output all the row common following will be the output of the inner join.

If you got this right then congratulations, if not then let’s understand how do we get this output :


Result of Left Join!
The left join will output all the rows of the left table and the rows will repeat if there are multiple occurrences of the key in the right table. The following will be the output of the left join :

To get to the output of the left join, we need to follow the same concept: compare the rows of left table with every row of the right table and (in left join) output the common rows of both the tables along with the unique rows of the left table.
Result of Right Join!
The right join is just like left join, the difference is that right table is your base table, so, the output will be the common rows of both the tables along with the unique rows of right table.

Result of Outer Join!
The outer join returns all the common rows (inner join output) of both the left and right table and the unique rows of both the tables.

If you like this blog and would like to keep yourself updated with my stories then you can follow me to get my post in your inbox.
You can support me and thousands of other writers by signing up for medium membership from this link, it will cost you $5 per month and you’ll support me with a portion of your fee. If you are joining, then many many thanks, and if not then also I wish you very happy learning :)
