课程: Intermediate SQL for Data Scientists

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Full outer joins

Full outer joins

- [Instructor] I'd like to look at one more type of join, and that's the full outer join. Now in this select statement, we are querying all of the columns in the employees table and in the company regions table. We're querying from data_sci.employees and we've aliased that as e. We're also querying from the data_sci.company_regions, which we've aliased as cr, and we're combining those two tables using a full outer join. Now what that means is we're going to take all of the rows from both tables. We're going to combine the rows that have corresponding values in the foreign key of one table in the primary key of the other. So for example, if there is an employee with a particular region ID and that region ID has a corresponding row in the company region table, we're going to combine those two sets of columns in the single row. Now this is a full outer join, so we're going to return all of the rows from the employees table and all of the rows from the company regions table, even if they…

内容