A.2. SQL and databases

A.2.1. Types of joins

Explain the difference between a left join and an inner join.

Ludamila Janda and Ayanthi G.

Example answer

Joins are ways of combining data from two different tables—a left table and a right table—into a new one. Joins work by connecting rows between the two tables; a set of key columns is used to find data in the two tables that are the same and should be connected. In the case of a left join, every row from the left table appears in the resulting table, but rows from the right table appear only if the values in their key columns show up in the left table. In an inner join, however, both rows from the left table and the right table appear only if there is a matching row in the other table.

Get Build a Career in Data Science now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.