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 - SQL Tutorial
From the course: SQL: Data Reporting and Analysis
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
-
-
-
-
-
-
(Locked)
Make your queries faster1m 47s
-
(Locked)
Understand SQL indexes and keys7m 16s
-
(Locked)
EDIT: Visualize your database7m 58s
-
(Locked)
Merge data across tables with JOIN5m 2s
-
(Locked)
Understand SQL JOINS4m 16s
-
(Locked)
Combine rows with SQL UNION4m 49s
-
(Locked)
Merge data across tables with IN2m 11s
-
(Locked)
Select from a selection with subqueries2m 56s
-
(Locked)
Challenge: Join tables1m 4s
-
(Locked)
Solution: Join tables4m 37s
-
(Locked)
-
-