2017  Kodetalk | Feedback | Privacy Policy | Terms | About
userimage

What are the different types of join and explain each of the join in SQL?

What are the different types of join and explain each of the join in SQL? It's an interview question and all the ans i gave, i feel like interviewer not ok with my answer?

userimage

There are many types of join which can be used to retrieve data and it depends on the relationship between tables.

1) Inner join : Inner join return rows when there is at least one match of rows between the tables.
2) Right Join : Right join return rows which are common between the tables and all rows of Right hand side table. Simply, it returns all the rows from the right hand side table even though there are no matches in the left hand side table.
3) Left Join : Left join return rows which are common between the tables and all rows of Left hand side table. Simply, it returns all the rows from Left hand side table even though there are no matches in the Right hand side table.
4) Full Join : Full join return rows when there are matching rows in any one of the tables. This means, it returns all the rows from the left hand side table and all the rows from the right hand side table.


Hope this ans will help you out.

Answer is