avatarAnmol Tomar

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

1460

Abstract

/figcaption></figure><p id="5abf">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.</p><h2 id="1a37">Result of Inner Join!</h2><p id="d20f">The inner join will output all the row common following will be the output of the inner join.</p><figure id="189f"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*UTgmOWr-ZiXnroO5tBAF6A.png"><figcaption></figcaption></figure><p id="fb28">If you got this right then congratulations, if not then let’s understand how do we get this output :</p><figure id="133a"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*7E2sGiJBNuYXvThh_jBJ7g.png"><figcaption></figcaption></figure><figure id="400d"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*BeCLOVnib0S0hrQ-jIhRHA.png"><figcaption>Image by Author</figcaption></figure><h2 id="0d84">Result of Left Join!</h2><p id="7649">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 :</p><figure id="95ae"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*86p2zJwwG2953WisSwu9Tw.png"><figcaption>Image by Author</figcaption></figure><p id="9da3">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 le

Options

ft join) output the common rows of both the tables along with the unique rows of the left table.</p><h2 id="b064">Result of Right Join!</h2><p id="d177">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.</p><figure id="a313"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*YsVvolCemDZqKXtqpUxfOA.png"><figcaption>Image by Author</figcaption></figure><h2 id="f975">Result of Outer Join!</h2><p id="cc12">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.</p><figure id="ac92"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*u0GLKe6M79iqZR4l60drug.png"><figcaption>Image by Author</figcaption></figure><p id="01fd"><i>If you like this blog and would like to keep yourself updated with my stories then you can<b> <a href="https://anmol3015.medium.com/subscribe">follow me to get my post</a></b> in your inbox.</i></p><p id="fa0d"><i>You can support me and thousands of other writers by signing up for medium <a href="https://anmol3015.medium.com/membership"><b>membership from this link</b></a>, 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 :)</i></p></article></body>

80% of Candidates Got This Join Concept Wrong In Interviews

Understand the concept about joins and crack your interviews

Pic Credits: Unsplash

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?

Image by Author

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 :

Image by Author

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 :

Image by Author

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.

Image by Author

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.

Image by Author

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 :)

Data Science
Python
Programming
Data Analysis
Interview
Recommended from ReadMedium