Skip to content

Commit

Permalink
Added diagram showing INNER and LEFT JOIN (datacarpentry#362)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamancer authored Jun 30, 2023
1 parent 9f6c1c7 commit 60ba7bd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion episodes/03-sql-joins.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,14 @@ In fact the `JOIN` keyword is simply shorthand for `INNER JOIN` and the two
terms can be used interchangeably as they will produce the same result.

We can also tell the computer that we wish to keep all the records in the first
table by using a `LEFT OUTER JOIN` clause, or `LEFT JOIN` for short.
table by using a `LEFT OUTER JOIN` clause, or `LEFT JOIN` for short. The difference
between the two JOINs can be visualized like so:

![
Diagrams representing INNER JOIN and LEFT JOIN in SQLite
](fig/sql-joins.png){
alt='Diagrams representing INNER JOIN and LEFT JOIN each include two overlapping circles labeled A (left) and B (right). For INNER JOIN, the intersection of the two circles is filled in. The associated query is SELECT * FROM A JOIN B ON A.Key = B.Key. For LEFT JOIN, circle A, including its intersection with circle B, is filled in. The associated query is SELECT * FROM A LEFT JOIN B ON A.Key = B.Key.'
}

::::::::::::::::::::::::::::::::::::::: challenge

Expand Down
Binary file added episodes/fig/sql-joins.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 60ba7bd

Please sign in to comment.