SlideShare a Scribd company logo
1 of 9
Download to read offline
VISUALIZING
SQL JOIN
V I N C E N T C H A N - D E C 2 0 1 6
INNER JOIN
TA B L E A TA B L E B
STAFF_ID NAME
1 JANE
2 MARY
3 JOHN
4 EMMA
s t a f f
STAFF_ID POSITION
7 CLERK
2 MANAGER
3 SUPERVISOR
5 EXECUTIVE
1 EXECUTIVE
P O S I T I O N
SELECT STAFF.STAFF_ID, STAFF.NAME, POSITION.POSITION
FROM STAFF
INNER JOIN POSITION
ON STAFF.STAFF_ID = POSITION.STAFF_ID
R E S U L T
S Q L C O M M A N D
STAFF_ID NAME POSITION
1 JANE EXECUTIVE
2 MARY MANAGER
3 JOHN SUPERVISOR
Returns all rows when there is at least one
match in BOTH tables
LEFT JOIN
TA B L E A TA B L E B
STAFF_ID NAME
1 JANE
2 MARY
3 JOHN
4 EMMA
s t a f f
STAFF_ID POSITION
7 CLERK
2 MANAGER
3 SUPERVISOR
5 EXECUTIVE
1 EXECUTIVE
P O S I T I O N
SELECT STAFF.STAFF_ID, STAFF.NAME, POSITION.POSITION
FROM STAFF
LEFT JOIN POSITION
ON STAFF.STAFF_ID = POSITION.STAFF_ID
R E S U L T
S Q L C O M M A N D
STAFF_ID NAME POSITION
1 JANE EXECUTIVE
2 MARY MANAGER
3 JOHN SUPERVISOR
4 EMMA NULL
Return all rows from the left table, and the
matched rows from the right table
RIGHT JOIN
TA B L E A TA B L E B
STAFF_ID NAME
1 JANE
2 MARY
3 JOHN
4 EMMA
s t a f f
STAFF_ID POSITION
7 CLERK
2 MANAGER
3 SUPERVISOR
5 EXECUTIVE
1 EXECUTIVE
P O S I T I O N
SELECT STAFF.STAFF_ID, STAFF.NAME, POSITION.POSITION
FROM STAFF
RIGHT JOIN POSITION
ON STAFF.STAFF_ID = POSITION.STAFF_ID
R E S U L T
S Q L C O M M A N D
STAFF_ID NAME POSITION
7 NULL CLERK
2 MARY MANAGER
3 JOHN SUPERVISOR
5 NULL EXECUTIVE
1 JANE EXECUTIVE
Return all rows from the right table, and
the matched rows from the left table
FULL OUTER JOIN
TA B L E A TA B L E B
STAFF_ID NAME
1 JANE
2 MARY
3 JOHN
4 EMMA
s t a f f
STAFF_ID POSITION
7 CLERK
2 MANAGER
3 SUPERVISOR
5 EXECUTIVE
1 EXECUTIVE
P O S I T I O N
SELECT STAFF.STAFF_ID, STAFF.NAME, POSITION.POSITION
FROM STAFF
FULL OUTER JOIN POSITION
ON STAFF.STAFF_ID = POSITION.STAFF_ID
R E S U L T
S Q L C O M M A N D
STAFF_ID NAME POSITION
1 JANE EXECUTIVE
2 MARY MANAGER
3 JOHN SUPERVISOR
4 EMMA NULL
7 NULL CLERK
5 NULL EXECUTIVE
Return all of the records from both tables
LEFT EXCLUDING JOIN
TA B L E A TA B L E B
STAFF_ID NAME
1 JANE
2 MARY
3 JOHN
4 EMMA
s t a f f
STAFF_ID POSITION
7 CLERK
2 MANAGER
3 SUPERVISOR
5 EXECUTIVE
1 EXECUTIVE
P O S I T I O N
SELECT STAFF.STAFF_ID, STAFF.NAME, POSITION.POSITION
FROM STAFF
LEFT JOIN POSITION
ON STAFF.STAFF_ID = POSITION.STAFF_ID
WHERE POSITION.POSITION IS NULL
R E S U L T
S Q L C O M M A N D
STAFF_ID NAME POSITION
1 JANE EXECUTIVE
4 EMMA NULL
Return all of the records in the left table
that do not match any records in the right
table
RIGHT EXCLUDING JOIN
TA B L E A TA B L E B
STAFF_ID NAME
1 JANE
2 MARY
3 JOHN
4 EMMA
s t a f f
STAFF_ID POSITION
7 CLERK
2 MANAGER
3 SUPERVISOR
5 EXECUTIVE
1 EXECUTIVE
P O S I T I O N
SELECT STAFF.STAFF_ID, STAFF.NAME, POSITION.POSITION
FROM STAFF
RIGHT JOIN POSITION
ON STAFF.STAFF_ID = POSITION.STAFF_ID
WHERE STAFF.NAME IS NULL
R E S U L T
S Q L C O M M A N D
STAFF_ID NAME POSITION
7 NULL CLERK
5 NULL EXECUTIVE
Return all of the records in the right table
that do not match any records in the left
table
OUTER EXCLUDING JOIN
TA B L E A TA B L E B
STAFF_ID NAME
1 JANE
2 MARY
3 JOHN
4 EMMA
s t a f f
STAFF_ID POSITION
7 CLERK
2 MANAGER
3 SUPERVISOR
5 EXECUTIVE
1 EXECUTIVE
P O S I T I O N
SELECT STAFF.STAFF_ID, STAFF.NAME, POSITION.POSITION
FROM STAFF
FULL OUTER JOIN POSITION
ON STAFF.STAFF_ID = POSITION.STAFF_ID
R E S U L T
S Q L C O M M A N D
STAFF_ID NAME POSITION
7 NULL CLERK
5 NULL EXECUTIVE
Return all of the records in the left table
and all of the records in the right table that
do not match
ALTERNATIVELY
A
INNER
JOIN
=
B 1 B 1
C 2 C 2
3
A
RIGHT
JOIN
=
B 1 B 1
C 2 C 2
3 3
A
LEFT
JOIN
=
A
B 1 B 1
C 2 C 2
3
A
FULL
JOIN
=
A
B 1 B 1
C 2 C 2
3 3

More Related Content

Viewers also liked (20)

SQL Joins
SQL JoinsSQL Joins
SQL Joins
 
SQL JOIN
SQL JOINSQL JOIN
SQL JOIN
 
MS Sql Server: Joining Databases
MS Sql Server: Joining DatabasesMS Sql Server: Joining Databases
MS Sql Server: Joining Databases
 
Joins
JoinsJoins
Joins
 
My sql join
My sql joinMy sql join
My sql join
 
Presentation1
Presentation1Presentation1
Presentation1
 
Webiko
WebikoWebiko
Webiko
 
Hadoop Mapreduce joins
Hadoop Mapreduce joinsHadoop Mapreduce joins
Hadoop Mapreduce joins
 
Example
Example Example
Example
 
SQL JOINS- Reena P V
SQL JOINS- Reena P VSQL JOINS- Reena P V
SQL JOINS- Reena P V
 
Join(sql)
Join(sql)Join(sql)
Join(sql)
 
Join
JoinJoin
Join
 
Disney's Business Overview
Disney's Business OverviewDisney's Business Overview
Disney's Business Overview
 
SQL Join Basic
SQL Join BasicSQL Join Basic
SQL Join Basic
 
SQL Tutorial - How To Create, Drop, and Truncate Table
SQL Tutorial - How To Create, Drop, and Truncate TableSQL Tutorial - How To Create, Drop, and Truncate Table
SQL Tutorial - How To Create, Drop, and Truncate Table
 
Semi join
Semi joinSemi join
Semi join
 
SQL Joins and Query Optimization
SQL Joins and Query OptimizationSQL Joins and Query Optimization
SQL Joins and Query Optimization
 
Sql joins
Sql joinsSql joins
Sql joins
 
Joins – which, when and why
Joins – which, when and whyJoins – which, when and why
Joins – which, when and why
 
GrabTaxi Strategy
GrabTaxi StrategyGrabTaxi Strategy
GrabTaxi Strategy
 

Recently uploaded

如何办理(UPenn毕业证书)宾夕法尼亚大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(UPenn毕业证书)宾夕法尼亚大学毕业证成绩单本科硕士学位证留信学历认证如何办理(UPenn毕业证书)宾夕法尼亚大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(UPenn毕业证书)宾夕法尼亚大学毕业证成绩单本科硕士学位证留信学历认证acoha1
 
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...Valters Lauzums
 
edited gordis ebook sixth edition david d.pdf
edited gordis ebook sixth edition david d.pdfedited gordis ebook sixth edition david d.pdf
edited gordis ebook sixth edition david d.pdfgreat91
 
Genuine love spell caster )! ,+27834335081) Ex lover back permanently in At...
Genuine love spell caster )! ,+27834335081)   Ex lover back permanently in At...Genuine love spell caster )! ,+27834335081)   Ex lover back permanently in At...
Genuine love spell caster )! ,+27834335081) Ex lover back permanently in At...BabaJohn3
 
AI Imagen for data-storytelling Infographics.pdf
AI Imagen for data-storytelling Infographics.pdfAI Imagen for data-storytelling Infographics.pdf
AI Imagen for data-storytelling Infographics.pdfMichaelSenkow
 
How I opened a fake bank account and didn't go to prison
How I opened a fake bank account and didn't go to prisonHow I opened a fake bank account and didn't go to prison
How I opened a fake bank account and didn't go to prisonPayment Village
 
NO1 Best Kala Jadu Expert Specialist In Germany Kala Jadu Expert Specialist I...
NO1 Best Kala Jadu Expert Specialist In Germany Kala Jadu Expert Specialist I...NO1 Best Kala Jadu Expert Specialist In Germany Kala Jadu Expert Specialist I...
NO1 Best Kala Jadu Expert Specialist In Germany Kala Jadu Expert Specialist I...Amil baba
 
如何办理哥伦比亚大学毕业证(Columbia毕业证)成绩单原版一比一
如何办理哥伦比亚大学毕业证(Columbia毕业证)成绩单原版一比一如何办理哥伦比亚大学毕业证(Columbia毕业证)成绩单原版一比一
如何办理哥伦比亚大学毕业证(Columbia毕业证)成绩单原版一比一fztigerwe
 
2024 Q2 Orange County (CA) Tableau User Group Meeting
2024 Q2 Orange County (CA) Tableau User Group Meeting2024 Q2 Orange County (CA) Tableau User Group Meeting
2024 Q2 Orange County (CA) Tableau User Group MeetingAlison Pitt
 
2024 Q1 Tableau User Group Leader Quarterly Call
2024 Q1 Tableau User Group Leader Quarterly Call2024 Q1 Tableau User Group Leader Quarterly Call
2024 Q1 Tableau User Group Leader Quarterly Calllward7
 
The Significance of Transliteration Enhancing
The Significance of Transliteration EnhancingThe Significance of Transliteration Enhancing
The Significance of Transliteration Enhancingmohamed Elzalabany
 
一比一原版阿德莱德大学毕业证成绩单如何办理
一比一原版阿德莱德大学毕业证成绩单如何办理一比一原版阿德莱德大学毕业证成绩单如何办理
一比一原版阿德莱德大学毕业证成绩单如何办理pyhepag
 
Atlantic Grupa Case Study (Mintec Data AI)
Atlantic Grupa Case Study (Mintec Data AI)Atlantic Grupa Case Study (Mintec Data AI)
Atlantic Grupa Case Study (Mintec Data AI)Jon Hansen
 
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证acoha1
 
一比一原版(Monash毕业证书)莫纳什大学毕业证成绩单如何办理
一比一原版(Monash毕业证书)莫纳什大学毕业证成绩单如何办理一比一原版(Monash毕业证书)莫纳什大学毕业证成绩单如何办理
一比一原版(Monash毕业证书)莫纳什大学毕业证成绩单如何办理pyhepag
 
How to Transform Clinical Trial Management with Advanced Data Analytics
How to Transform Clinical Trial Management with Advanced Data AnalyticsHow to Transform Clinical Trial Management with Advanced Data Analytics
How to Transform Clinical Trial Management with Advanced Data AnalyticsBrainSell Technologies
 
Audience Researchndfhcvnfgvgbhujhgfv.pptx
Audience Researchndfhcvnfgvgbhujhgfv.pptxAudience Researchndfhcvnfgvgbhujhgfv.pptx
Audience Researchndfhcvnfgvgbhujhgfv.pptxStephen266013
 
Aggregations - The Elasticsearch "GROUP BY"
Aggregations - The Elasticsearch "GROUP BY"Aggregations - The Elasticsearch "GROUP BY"
Aggregations - The Elasticsearch "GROUP BY"John Sobanski
 
1:1原版定制利物浦大学毕业证(Liverpool毕业证)成绩单学位证书留信学历认证
1:1原版定制利物浦大学毕业证(Liverpool毕业证)成绩单学位证书留信学历认证1:1原版定制利物浦大学毕业证(Liverpool毕业证)成绩单学位证书留信学历认证
1:1原版定制利物浦大学毕业证(Liverpool毕业证)成绩单学位证书留信学历认证ppy8zfkfm
 

Recently uploaded (20)

如何办理(UPenn毕业证书)宾夕法尼亚大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(UPenn毕业证书)宾夕法尼亚大学毕业证成绩单本科硕士学位证留信学历认证如何办理(UPenn毕业证书)宾夕法尼亚大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(UPenn毕业证书)宾夕法尼亚大学毕业证成绩单本科硕士学位证留信学历认证
 
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
Data Analytics for Digital Marketing Lecture for Advanced Digital & Social Me...
 
edited gordis ebook sixth edition david d.pdf
edited gordis ebook sixth edition david d.pdfedited gordis ebook sixth edition david d.pdf
edited gordis ebook sixth edition david d.pdf
 
Abortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotec
Abortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotecAbortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotec
Abortion pills in Riyadh Saudi Arabia (+966572737505 buy cytotec
 
Genuine love spell caster )! ,+27834335081) Ex lover back permanently in At...
Genuine love spell caster )! ,+27834335081)   Ex lover back permanently in At...Genuine love spell caster )! ,+27834335081)   Ex lover back permanently in At...
Genuine love spell caster )! ,+27834335081) Ex lover back permanently in At...
 
AI Imagen for data-storytelling Infographics.pdf
AI Imagen for data-storytelling Infographics.pdfAI Imagen for data-storytelling Infographics.pdf
AI Imagen for data-storytelling Infographics.pdf
 
How I opened a fake bank account and didn't go to prison
How I opened a fake bank account and didn't go to prisonHow I opened a fake bank account and didn't go to prison
How I opened a fake bank account and didn't go to prison
 
NO1 Best Kala Jadu Expert Specialist In Germany Kala Jadu Expert Specialist I...
NO1 Best Kala Jadu Expert Specialist In Germany Kala Jadu Expert Specialist I...NO1 Best Kala Jadu Expert Specialist In Germany Kala Jadu Expert Specialist I...
NO1 Best Kala Jadu Expert Specialist In Germany Kala Jadu Expert Specialist I...
 
如何办理哥伦比亚大学毕业证(Columbia毕业证)成绩单原版一比一
如何办理哥伦比亚大学毕业证(Columbia毕业证)成绩单原版一比一如何办理哥伦比亚大学毕业证(Columbia毕业证)成绩单原版一比一
如何办理哥伦比亚大学毕业证(Columbia毕业证)成绩单原版一比一
 
2024 Q2 Orange County (CA) Tableau User Group Meeting
2024 Q2 Orange County (CA) Tableau User Group Meeting2024 Q2 Orange County (CA) Tableau User Group Meeting
2024 Q2 Orange County (CA) Tableau User Group Meeting
 
2024 Q1 Tableau User Group Leader Quarterly Call
2024 Q1 Tableau User Group Leader Quarterly Call2024 Q1 Tableau User Group Leader Quarterly Call
2024 Q1 Tableau User Group Leader Quarterly Call
 
The Significance of Transliteration Enhancing
The Significance of Transliteration EnhancingThe Significance of Transliteration Enhancing
The Significance of Transliteration Enhancing
 
一比一原版阿德莱德大学毕业证成绩单如何办理
一比一原版阿德莱德大学毕业证成绩单如何办理一比一原版阿德莱德大学毕业证成绩单如何办理
一比一原版阿德莱德大学毕业证成绩单如何办理
 
Atlantic Grupa Case Study (Mintec Data AI)
Atlantic Grupa Case Study (Mintec Data AI)Atlantic Grupa Case Study (Mintec Data AI)
Atlantic Grupa Case Study (Mintec Data AI)
 
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
如何办理(WashU毕业证书)圣路易斯华盛顿大学毕业证成绩单本科硕士学位证留信学历认证
 
一比一原版(Monash毕业证书)莫纳什大学毕业证成绩单如何办理
一比一原版(Monash毕业证书)莫纳什大学毕业证成绩单如何办理一比一原版(Monash毕业证书)莫纳什大学毕业证成绩单如何办理
一比一原版(Monash毕业证书)莫纳什大学毕业证成绩单如何办理
 
How to Transform Clinical Trial Management with Advanced Data Analytics
How to Transform Clinical Trial Management with Advanced Data AnalyticsHow to Transform Clinical Trial Management with Advanced Data Analytics
How to Transform Clinical Trial Management with Advanced Data Analytics
 
Audience Researchndfhcvnfgvgbhujhgfv.pptx
Audience Researchndfhcvnfgvgbhujhgfv.pptxAudience Researchndfhcvnfgvgbhujhgfv.pptx
Audience Researchndfhcvnfgvgbhujhgfv.pptx
 
Aggregations - The Elasticsearch "GROUP BY"
Aggregations - The Elasticsearch "GROUP BY"Aggregations - The Elasticsearch "GROUP BY"
Aggregations - The Elasticsearch "GROUP BY"
 
1:1原版定制利物浦大学毕业证(Liverpool毕业证)成绩单学位证书留信学历认证
1:1原版定制利物浦大学毕业证(Liverpool毕业证)成绩单学位证书留信学历认证1:1原版定制利物浦大学毕业证(Liverpool毕业证)成绩单学位证书留信学历认证
1:1原版定制利物浦大学毕业证(Liverpool毕业证)成绩单学位证书留信学历认证
 

SQL JOIN Explained Visually

  • 1. VISUALIZING SQL JOIN V I N C E N T C H A N - D E C 2 0 1 6
  • 2. INNER JOIN TA B L E A TA B L E B STAFF_ID NAME 1 JANE 2 MARY 3 JOHN 4 EMMA s t a f f STAFF_ID POSITION 7 CLERK 2 MANAGER 3 SUPERVISOR 5 EXECUTIVE 1 EXECUTIVE P O S I T I O N SELECT STAFF.STAFF_ID, STAFF.NAME, POSITION.POSITION FROM STAFF INNER JOIN POSITION ON STAFF.STAFF_ID = POSITION.STAFF_ID R E S U L T S Q L C O M M A N D STAFF_ID NAME POSITION 1 JANE EXECUTIVE 2 MARY MANAGER 3 JOHN SUPERVISOR Returns all rows when there is at least one match in BOTH tables
  • 3. LEFT JOIN TA B L E A TA B L E B STAFF_ID NAME 1 JANE 2 MARY 3 JOHN 4 EMMA s t a f f STAFF_ID POSITION 7 CLERK 2 MANAGER 3 SUPERVISOR 5 EXECUTIVE 1 EXECUTIVE P O S I T I O N SELECT STAFF.STAFF_ID, STAFF.NAME, POSITION.POSITION FROM STAFF LEFT JOIN POSITION ON STAFF.STAFF_ID = POSITION.STAFF_ID R E S U L T S Q L C O M M A N D STAFF_ID NAME POSITION 1 JANE EXECUTIVE 2 MARY MANAGER 3 JOHN SUPERVISOR 4 EMMA NULL Return all rows from the left table, and the matched rows from the right table
  • 4. RIGHT JOIN TA B L E A TA B L E B STAFF_ID NAME 1 JANE 2 MARY 3 JOHN 4 EMMA s t a f f STAFF_ID POSITION 7 CLERK 2 MANAGER 3 SUPERVISOR 5 EXECUTIVE 1 EXECUTIVE P O S I T I O N SELECT STAFF.STAFF_ID, STAFF.NAME, POSITION.POSITION FROM STAFF RIGHT JOIN POSITION ON STAFF.STAFF_ID = POSITION.STAFF_ID R E S U L T S Q L C O M M A N D STAFF_ID NAME POSITION 7 NULL CLERK 2 MARY MANAGER 3 JOHN SUPERVISOR 5 NULL EXECUTIVE 1 JANE EXECUTIVE Return all rows from the right table, and the matched rows from the left table
  • 5. FULL OUTER JOIN TA B L E A TA B L E B STAFF_ID NAME 1 JANE 2 MARY 3 JOHN 4 EMMA s t a f f STAFF_ID POSITION 7 CLERK 2 MANAGER 3 SUPERVISOR 5 EXECUTIVE 1 EXECUTIVE P O S I T I O N SELECT STAFF.STAFF_ID, STAFF.NAME, POSITION.POSITION FROM STAFF FULL OUTER JOIN POSITION ON STAFF.STAFF_ID = POSITION.STAFF_ID R E S U L T S Q L C O M M A N D STAFF_ID NAME POSITION 1 JANE EXECUTIVE 2 MARY MANAGER 3 JOHN SUPERVISOR 4 EMMA NULL 7 NULL CLERK 5 NULL EXECUTIVE Return all of the records from both tables
  • 6. LEFT EXCLUDING JOIN TA B L E A TA B L E B STAFF_ID NAME 1 JANE 2 MARY 3 JOHN 4 EMMA s t a f f STAFF_ID POSITION 7 CLERK 2 MANAGER 3 SUPERVISOR 5 EXECUTIVE 1 EXECUTIVE P O S I T I O N SELECT STAFF.STAFF_ID, STAFF.NAME, POSITION.POSITION FROM STAFF LEFT JOIN POSITION ON STAFF.STAFF_ID = POSITION.STAFF_ID WHERE POSITION.POSITION IS NULL R E S U L T S Q L C O M M A N D STAFF_ID NAME POSITION 1 JANE EXECUTIVE 4 EMMA NULL Return all of the records in the left table that do not match any records in the right table
  • 7. RIGHT EXCLUDING JOIN TA B L E A TA B L E B STAFF_ID NAME 1 JANE 2 MARY 3 JOHN 4 EMMA s t a f f STAFF_ID POSITION 7 CLERK 2 MANAGER 3 SUPERVISOR 5 EXECUTIVE 1 EXECUTIVE P O S I T I O N SELECT STAFF.STAFF_ID, STAFF.NAME, POSITION.POSITION FROM STAFF RIGHT JOIN POSITION ON STAFF.STAFF_ID = POSITION.STAFF_ID WHERE STAFF.NAME IS NULL R E S U L T S Q L C O M M A N D STAFF_ID NAME POSITION 7 NULL CLERK 5 NULL EXECUTIVE Return all of the records in the right table that do not match any records in the left table
  • 8. OUTER EXCLUDING JOIN TA B L E A TA B L E B STAFF_ID NAME 1 JANE 2 MARY 3 JOHN 4 EMMA s t a f f STAFF_ID POSITION 7 CLERK 2 MANAGER 3 SUPERVISOR 5 EXECUTIVE 1 EXECUTIVE P O S I T I O N SELECT STAFF.STAFF_ID, STAFF.NAME, POSITION.POSITION FROM STAFF FULL OUTER JOIN POSITION ON STAFF.STAFF_ID = POSITION.STAFF_ID R E S U L T S Q L C O M M A N D STAFF_ID NAME POSITION 7 NULL CLERK 5 NULL EXECUTIVE Return all of the records in the left table and all of the records in the right table that do not match
  • 9. ALTERNATIVELY A INNER JOIN = B 1 B 1 C 2 C 2 3 A RIGHT JOIN = B 1 B 1 C 2 C 2 3 3 A LEFT JOIN = A B 1 B 1 C 2 C 2 3 A FULL JOIN = A B 1 B 1 C 2 C 2 3 3