From the course: SQL: Data Reporting and Analysis

Unlock the full course today

Join today to access over 23,400 courses taught by industry experts.

Understand SQL JOINS

Understand SQL JOINS

- [Instructor] Now we're going to look at different kinds of join: inner join, outer join, left join, and right join, using some fake data. We've already seen that an inner join and a join means the same thing. It's where rows are returned where they exist in both tables and it's like the middle of a Venn diagram. Now, here we have table A and table B. Table A contains days of the week with five rows named Monday to Friday. And table B contains four people's names. Let's say on each day one person is required to work at a shop. You can see the query in the arrow. How many rows do you think an inner join is going to give us from this? It gives us four rows. Friday has disappeared because there's no person ID of seven in table B. And we don't see Fatima in the results because there's no person ID of four in table A. But Fred is down for two days' work. So while only IDs one, two, and three occur in both tables, we…

Contents