Database Design Book
kb.databasedesignbook.com·6w

Posts

A modern guide to SQL JOINs

Author: Alexey Makhotkin squadette@gmail.com. There are many SQL JOINs guides and tutorials, but this one takes a different approach. We try to avoid misleading wording and imagery, and we structure the material in a different way. The goal of this article is to clarify your mental model. (~6600 words) Table of contents Prerequisites Starting with LEFT JOIN Use canonical syntax Use only ID equality in ON condition “Learning foreign language” metaphor Example dataset: employees/payments LEFT JOIN: N:1 case N:1, 1:N, and M:N cases SQL may be too permissive LEFT JOIN: 1:N case Why you should only use ID equality Self-join Fully general LEFT JOIN algorithm Things to remember, pt.

[read more](…

Similar Posts

Loading similar posts...

Keyboard Shortcuts

Navigation
Next / previous item
j/k
Open post
oorEnter
Preview post
v
Post Actions
Love post
a
Like post
l
Dislike post
d
Undo reaction
u
Recommendations
Add interest / feed
Enter
Not interested
x
Go to
Home
gh
Interests
gi
Feeds
gf
Likes
gl
History
gy
Changelog
gc
Settings
gs
Browse
gb
Search
/
General
Show this help
?
Submit feedback
!
Close modal / unfocus
Esc

Press ? anytime to show this help