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

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