
11

SQL joins cheatsheet
source link: https://devhints.io/sql-join
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Example
SELECT * FROM order_items \
LEFT OUTER JOIN orders \
ON order_items.order_id = orders.id
Joins are typically added to SELECT
statements to add more columns and records.
Diagram
SELECT * FROM `A` INNER JOIN `B`
┌────────┐
│ A ┌───┼────┐
│ │ ∩ │ │
└────┼───┘ B │
└────────┘
Inner join
∩
Left outer join
A
+ ∩
Right outer join
∩
+ B
Full outer join
A
+ ∩
+ B
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK