From the course: SQL: Data Reporting and Analysis
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Merge data across tables with JOIN - SQL Tutorial
From the course: SQL: Data Reporting and Analysis
Merge data across tables with JOIN
- [Instructor] Sometimes you need data from more than one table. What if we want a report that shows all customers and their addresses, where the district falls in Buenos Aires. We can't do this from the customer table because if we have a look at all the fields in here, there's no address data. All we've got is an ID of an address that exists in the address table. To run this query, we have to merge or join data from two tables. The basic structure of a join is straightforward. Select star from customer, Join the address table on customer.address ID equals address, address ID, and hit go. Now, if we look down here, these fields should look familiar, customer, blah, blah, blah, email, address ID, and active create date and last update. So all of those fields are our customer table. And then from address ID, we start with our address fields that also go over to last update. And if we compare the address ID field…
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)
-
-