From the course: Quick Start Guide to SQL

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Types of joins

Types of joins

- [Instructor] Now let's learn all about joins. We use joins to fetch data from one or more tables at a time. This is the syntax for joins: select columns from table_name1 followed by the joint_name, that is the type of join we use. Then table_name2 on. On is a keyword here followed by the join conditions. Now based on the data we need, joins are categorized into four types: inner join, right join, left join and full outer join. Let's look at each of these with examples. The first one is the inner join. Inner join retrieves all rows matching in both the tables. Like here in this example, the two tables that we are trying to join are country_tab table and states_tab table. So here, it's going to retrieve only those rows that match in both the tables. So this is how the Venn diagram looks for the inner join. Let's look at this example in Live SQL. I've written the same example over here and I've also written the…

Contents