SlideShare a Scribd company logo
SQL JOINS
Ankit Rai
Outline
1.
WHAT IS SQL
JOIN
2.
WHY JOIN IS
USED
3.
TYPES OF SQL
JOINS
4.
SQL INNER JOIN
5.
SQL OUTER JOIN
6.
SQL LEFT JOIN
7.
SQL RIGHT JOIN
7.
SQL CROSS
JOIN
7.
SQL SELF JOIN
Ankit Rai
WHAT IS SQL JOIN
SQL join combines rows from more than
one table by using common column in both
the tables.
Ankit Rai
WHY WE USE SQL JOIN?
 Flexibility – It allows the user to access and manage records from more than
one table.
 Data Redundancy – SQL join allows us to keep data redundancy low so that
we can reduce the amount of data anomalies.
 Efficiency – Executes faster and shows results much more quickly than any
other sub query.
Ankit Rai
TYPES OF JOINS
1
INNER JOIN
2
OUTER
JOIN
3
LEFT JOIN
4
RIGHT JOIN
5
CROSS JOIN
6
SELF JOIN
Ankit Rai
INNER JOIN
Inner join returns a new table by
combining records that only have
matching values in both the tables.
SYNTAX
SELECT table1.col_name, table2.col_name,…...
FROM table1
INNER JOIN table2
ON table1.column = table2.column;
Ankit Rai
OUTER JOIN
Outer join returns all those records
which are in either the left table or right
table.
SYNTAX
SELECT table1.col_name, table2.col_name,…...
FROM table1
FULL OUTER JOIN table2
ON table1.column = table2.column;
Ankit Rai
LEFT JOIN
Left join returns all the rows from the left table and matching rows from the right
table.
SYNTAX
SELECT table1.col_name, table2.col_name,…...
FROM table1
LEFT JOIN table2
ON table1.column = table2.column;
Ankit Rai
RIGHT JOIN
Right join returns all the rows from the right table and all the matching records from
the left table.
SYNTAX
SELECT table1.col_name, table2.col_name,…...
FROM table1
RIGHT JOIN table2
ON table1.column = table2.column;
Ankit Rai
CROSS JOIN
A cross join is a type of join that returns the Cartesian product of rows from the tables in the
join. In other words, it combines each row from the first table with each row from the second
table.
SYNTAX
SELECT table1.col_name, table2.col_name,…...
FROM table1
CROSS JOIN table2
ON table1.column = table2.column;
Ankit Rai
SELF JOIN
A self join is a join in which a table is joined with itself (which is also called unary
relationship).
To join a table itself means that each row of the table is combined with itself and with
every other row of the table.
SYNTAX
SELECT column(s)
FROM table1 t1, table1 t2
WHERE condition;
Ankit Rai
THANK YOU!
Ankit Rai
Ad

More Related Content

What's hot (20)

SQL JOIN
SQL JOINSQL JOIN
SQL JOIN
Ritwik Das
 
Sql ppt
Sql pptSql ppt
Sql ppt
Anuja Lad
 
Types Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql ServerTypes Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql Server
programmings guru
 
SQL Overview
SQL OverviewSQL Overview
SQL Overview
Stewart Rogers
 
introdution to SQL and SQL functions
introdution to SQL and SQL functionsintrodution to SQL and SQL functions
introdution to SQL and SQL functions
farwa waqar
 
Join query
Join queryJoin query
Join query
Waqar Ali
 
SQL(DDL & DML)
SQL(DDL & DML)SQL(DDL & DML)
SQL(DDL & DML)
Sharad Dubey
 
SQL Views
SQL ViewsSQL Views
SQL Views
baabtra.com - No. 1 supplier of quality freshers
 
Joins And Its Types
Joins And Its TypesJoins And Its Types
Joins And Its Types
Wings Interactive
 
SQL - DML and DDL Commands
SQL - DML and DDL CommandsSQL - DML and DDL Commands
SQL - DML and DDL Commands
Shrija Madhu
 
SQL commands
SQL commandsSQL commands
SQL commands
GirdharRatne
 
Sql commands
Sql commandsSql commands
Sql commands
Pooja Dixit
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
Sachidananda M H
 
SQL Functions
SQL FunctionsSQL Functions
SQL Functions
ammarbrohi
 
Sql commands
Sql commandsSql commands
Sql commands
Balakumaran Arunachalam
 
Trigger
TriggerTrigger
Trigger
VForce Infotech
 
DATABASE CONSTRAINTS
DATABASE CONSTRAINTSDATABASE CONSTRAINTS
DATABASE CONSTRAINTS
sunanditaAnand
 
Sql Constraints
Sql ConstraintsSql Constraints
Sql Constraints
I L0V3 CODING DR
 
1 - Introduction to PL/SQL
1 - Introduction to PL/SQL1 - Introduction to PL/SQL
1 - Introduction to PL/SQL
rehaniltifat
 
SQL JOINS
SQL JOINSSQL JOINS
SQL JOINS
Swapnali Pawar
 

Similar to SQL Joins.pptx (20)

sqljoins-220527115331-828e9932 (dee1).pptx
sqljoins-220527115331-828e9932 (dee1).pptxsqljoins-220527115331-828e9932 (dee1).pptx
sqljoins-220527115331-828e9932 (dee1).pptx
kailasmanoj
 
Kailas Manoj SQL Joins.pptxhgvhhhbjgjjjjjgjgjjj
Kailas Manoj SQL Joins.pptxhgvhhhbjgjjjjjgjgjjjKailas Manoj SQL Joins.pptxhgvhhhbjgjjjjjgjgjjj
Kailas Manoj SQL Joins.pptxhgvhhhbjgjjjjjgjgjjj
kailasmanoj
 
Kailas Manoj SQL Joins.pdfhvhggjbhbbjbjbbjbj
Kailas Manoj SQL Joins.pdfhvhggjbhbbjbjbbjbjKailas Manoj SQL Joins.pdfhvhggjbhbbjbjbbjbj
Kailas Manoj SQL Joins.pdfhvhggjbhbbjbjbbjbj
kailasmanoj
 
Join in SQL - Inner, Self, Outer Join
Join in SQL - Inner, Self, Outer JoinJoin in SQL - Inner, Self, Outer Join
Join in SQL - Inner, Self, Outer Join
Souma Maiti
 
JOINS.pptx
JOINS.pptxJOINS.pptx
JOINS.pptx
ArunkumarT51
 
joins and subqueries in big data analysis
joins and subqueries in big data analysisjoins and subqueries in big data analysis
joins and subqueries in big data analysis
SanSan149
 
V19 join method-c
V19 join method-cV19 join method-c
V19 join method-c
Dhirendra Chauhan
 
SQL JOIN.pptx
SQL JOIN.pptxSQL JOIN.pptx
SQL JOIN.pptx
johnwick814916
 
database .pptx
database .pptxdatabase .pptx
database .pptx
Mohammad Adnan
 
Sql(structured query language)
Sql(structured query language)Sql(structured query language)
Sql(structured query language)
Ishucs
 
joins IN DATA BASE MANAGEMENT SYSTEMSppt
joins IN DATA BASE MANAGEMENT SYSTEMSpptjoins IN DATA BASE MANAGEMENT SYSTEMSppt
joins IN DATA BASE MANAGEMENT SYSTEMSppt
Uma Kakarlapudi
 
MySQL JOINS
MySQL JOINSMySQL JOINS
MySQL JOINS
HripsimeGhaltaghchya
 
Understanding-SQL-Joins vvvvvvvvvv.pptx.
Understanding-SQL-Joins vvvvvvvvvv.pptx.Understanding-SQL-Joins vvvvvvvvvv.pptx.
Understanding-SQL-Joins vvvvvvvvvv.pptx.
carabkamas
 
Joins in SQL
Joins in SQLJoins in SQL
Joins in SQL
Pooja Dixit
 
Joining
JoiningJoining
Joining
Abrar ali
 
Relational algebra
Relational algebraRelational algebra
Relational algebra
Joshi Vinay
 
Sql basics v2
Sql basics v2Sql basics v2
Sql basics v2
Yousuf Akhtar Sultan
 
askndmf,dskmlf,bvdmk,v nmdsvjkmc,dvjkcmsdcvjnkmd
askndmf,dskmlf,bvdmk,v nmdsvjkmc,dvjkcmsdcvjnkmdaskndmf,dskmlf,bvdmk,v nmdsvjkmc,dvjkcmsdcvjnkmd
askndmf,dskmlf,bvdmk,v nmdsvjkmc,dvjkcmsdcvjnkmd
talhahakeem295
 
View od dffmfmfmm,dm,f,dm,dfm,dddfdfsd,sd,sddf,df,ldf
View od dffmfmfmm,dm,f,dm,dfm,dddfdfsd,sd,sddf,df,ldfView od dffmfmfmm,dm,f,dm,dfm,dddfdfsd,sd,sddf,df,ldf
View od dffmfmfmm,dm,f,dm,dfm,dddfdfsd,sd,sddf,df,ldf
talhahakeem295
 
SQL PPT on joins
SQL PPT on joinsSQL PPT on joins
SQL PPT on joins
VijaysukumarV
 
sqljoins-220527115331-828e9932 (dee1).pptx
sqljoins-220527115331-828e9932 (dee1).pptxsqljoins-220527115331-828e9932 (dee1).pptx
sqljoins-220527115331-828e9932 (dee1).pptx
kailasmanoj
 
Kailas Manoj SQL Joins.pptxhgvhhhbjgjjjjjgjgjjj
Kailas Manoj SQL Joins.pptxhgvhhhbjgjjjjjgjgjjjKailas Manoj SQL Joins.pptxhgvhhhbjgjjjjjgjgjjj
Kailas Manoj SQL Joins.pptxhgvhhhbjgjjjjjgjgjjj
kailasmanoj
 
Kailas Manoj SQL Joins.pdfhvhggjbhbbjbjbbjbj
Kailas Manoj SQL Joins.pdfhvhggjbhbbjbjbbjbjKailas Manoj SQL Joins.pdfhvhggjbhbbjbjbbjbj
Kailas Manoj SQL Joins.pdfhvhggjbhbbjbjbbjbj
kailasmanoj
 
Join in SQL - Inner, Self, Outer Join
Join in SQL - Inner, Self, Outer JoinJoin in SQL - Inner, Self, Outer Join
Join in SQL - Inner, Self, Outer Join
Souma Maiti
 
joins and subqueries in big data analysis
joins and subqueries in big data analysisjoins and subqueries in big data analysis
joins and subqueries in big data analysis
SanSan149
 
Sql(structured query language)
Sql(structured query language)Sql(structured query language)
Sql(structured query language)
Ishucs
 
joins IN DATA BASE MANAGEMENT SYSTEMSppt
joins IN DATA BASE MANAGEMENT SYSTEMSpptjoins IN DATA BASE MANAGEMENT SYSTEMSppt
joins IN DATA BASE MANAGEMENT SYSTEMSppt
Uma Kakarlapudi
 
Understanding-SQL-Joins vvvvvvvvvv.pptx.
Understanding-SQL-Joins vvvvvvvvvv.pptx.Understanding-SQL-Joins vvvvvvvvvv.pptx.
Understanding-SQL-Joins vvvvvvvvvv.pptx.
carabkamas
 
Relational algebra
Relational algebraRelational algebra
Relational algebra
Joshi Vinay
 
askndmf,dskmlf,bvdmk,v nmdsvjkmc,dvjkcmsdcvjnkmd
askndmf,dskmlf,bvdmk,v nmdsvjkmc,dvjkcmsdcvjnkmdaskndmf,dskmlf,bvdmk,v nmdsvjkmc,dvjkcmsdcvjnkmd
askndmf,dskmlf,bvdmk,v nmdsvjkmc,dvjkcmsdcvjnkmd
talhahakeem295
 
View od dffmfmfmm,dm,f,dm,dfm,dddfdfsd,sd,sddf,df,ldf
View od dffmfmfmm,dm,f,dm,dfm,dddfdfsd,sd,sddf,df,ldfView od dffmfmfmm,dm,f,dm,dfm,dddfdfsd,sd,sddf,df,ldf
View od dffmfmfmm,dm,f,dm,dfm,dddfdfsd,sd,sddf,df,ldf
talhahakeem295
 
Ad

More from Ankit Rai (6)

Chapter Review Guide
Chapter Review GuideChapter Review Guide
Chapter Review Guide
Ankit Rai
 
Inventory models
Inventory modelsInventory models
Inventory models
Ankit Rai
 
IoT in Oil and Gas Industry
IoT in Oil and Gas IndustryIoT in Oil and Gas Industry
IoT in Oil and Gas Industry
Ankit Rai
 
Keys in Database Management System
Keys in Database Management SystemKeys in Database Management System
Keys in Database Management System
Ankit Rai
 
Supervised Machine Learning
Supervised Machine LearningSupervised Machine Learning
Supervised Machine Learning
Ankit Rai
 
Exception handling in Java
Exception handling in JavaException handling in Java
Exception handling in Java
Ankit Rai
 
Chapter Review Guide
Chapter Review GuideChapter Review Guide
Chapter Review Guide
Ankit Rai
 
Inventory models
Inventory modelsInventory models
Inventory models
Ankit Rai
 
IoT in Oil and Gas Industry
IoT in Oil and Gas IndustryIoT in Oil and Gas Industry
IoT in Oil and Gas Industry
Ankit Rai
 
Keys in Database Management System
Keys in Database Management SystemKeys in Database Management System
Keys in Database Management System
Ankit Rai
 
Supervised Machine Learning
Supervised Machine LearningSupervised Machine Learning
Supervised Machine Learning
Ankit Rai
 
Exception handling in Java
Exception handling in JavaException handling in Java
Exception handling in Java
Ankit Rai
 
Ad

Recently uploaded (20)

Developing Security Orchestration, Automation, and Response Applications
Developing Security Orchestration, Automation, and Response ApplicationsDeveloping Security Orchestration, Automation, and Response Applications
Developing Security Orchestration, Automation, and Response Applications
VICTOR MAESTRE RAMIREZ
 
GenAI for Quant Analytics: survey-analytics.ai
GenAI for Quant Analytics: survey-analytics.aiGenAI for Quant Analytics: survey-analytics.ai
GenAI for Quant Analytics: survey-analytics.ai
Inspirient
 
183409-christina-rossetti.pdfdsfsdasggsag
183409-christina-rossetti.pdfdsfsdasggsag183409-christina-rossetti.pdfdsfsdasggsag
183409-christina-rossetti.pdfdsfsdasggsag
fardin123rahman07
 
Safety Innovation in Mt. Vernon A Westchester County Model for New Rochelle a...
Safety Innovation in Mt. Vernon A Westchester County Model for New Rochelle a...Safety Innovation in Mt. Vernon A Westchester County Model for New Rochelle a...
Safety Innovation in Mt. Vernon A Westchester County Model for New Rochelle a...
James Francis Paradigm Asset Management
 
How iCode cybertech Helped Me Recover My Lost Funds
How iCode cybertech Helped Me Recover My Lost FundsHow iCode cybertech Helped Me Recover My Lost Funds
How iCode cybertech Helped Me Recover My Lost Funds
ireneschmid345
 
chapter 4 Variability statistical research .pptx
chapter 4 Variability statistical research .pptxchapter 4 Variability statistical research .pptx
chapter 4 Variability statistical research .pptx
justinebandajbn
 
Cleaned_Lecture 6666666_Simulation_I.pdf
Cleaned_Lecture 6666666_Simulation_I.pdfCleaned_Lecture 6666666_Simulation_I.pdf
Cleaned_Lecture 6666666_Simulation_I.pdf
alcinialbob1234
 
chapter3 Central Tendency statistics.ppt
chapter3 Central Tendency statistics.pptchapter3 Central Tendency statistics.ppt
chapter3 Central Tendency statistics.ppt
justinebandajbn
 
LLM finetuning for multiple choice google bert
LLM finetuning for multiple choice google bertLLM finetuning for multiple choice google bert
LLM finetuning for multiple choice google bert
ChadapornK
 
C++_OOPs_DSA1_Presentation_Template.pptx
C++_OOPs_DSA1_Presentation_Template.pptxC++_OOPs_DSA1_Presentation_Template.pptx
C++_OOPs_DSA1_Presentation_Template.pptx
aquibnoor22079
 
Deloitte Analytics - Applying Process Mining in an audit context
Deloitte Analytics - Applying Process Mining in an audit contextDeloitte Analytics - Applying Process Mining in an audit context
Deloitte Analytics - Applying Process Mining in an audit context
Process mining Evangelist
 
03 Daniel 2-notes.ppt seminario escatologia
03 Daniel 2-notes.ppt seminario escatologia03 Daniel 2-notes.ppt seminario escatologia
03 Daniel 2-notes.ppt seminario escatologia
Alexander Romero Arosquipa
 
Flip flop presenation-Presented By Mubahir khan.pptx
Flip flop presenation-Presented By Mubahir khan.pptxFlip flop presenation-Presented By Mubahir khan.pptx
Flip flop presenation-Presented By Mubahir khan.pptx
mubashirkhan45461
 
IAS-slides2-ia-aaaaaaaaaaain-business.pdf
IAS-slides2-ia-aaaaaaaaaaain-business.pdfIAS-slides2-ia-aaaaaaaaaaain-business.pdf
IAS-slides2-ia-aaaaaaaaaaain-business.pdf
mcgardenlevi9
 
CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...
CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...
CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...
ThanushsaranS
 
VKS-Python Basics for Beginners and advance.pptx
VKS-Python Basics for Beginners and advance.pptxVKS-Python Basics for Beginners and advance.pptx
VKS-Python Basics for Beginners and advance.pptx
Vinod Srivastava
 
Conic Sectionfaggavahabaayhahahahahs.pptx
Conic Sectionfaggavahabaayhahahahahs.pptxConic Sectionfaggavahabaayhahahahahs.pptx
Conic Sectionfaggavahabaayhahahahahs.pptx
taiwanesechetan
 
Defense Against LLM Scheming 2025_04_28.pptx
Defense Against LLM Scheming 2025_04_28.pptxDefense Against LLM Scheming 2025_04_28.pptx
Defense Against LLM Scheming 2025_04_28.pptx
Greg Makowski
 
DPR_Expert_Recruitment_notice_Revised.pdf
DPR_Expert_Recruitment_notice_Revised.pdfDPR_Expert_Recruitment_notice_Revised.pdf
DPR_Expert_Recruitment_notice_Revised.pdf
inmishra17121973
 
FPET_Implementation_2_MA to 360 Engage Direct.pptx
FPET_Implementation_2_MA to 360 Engage Direct.pptxFPET_Implementation_2_MA to 360 Engage Direct.pptx
FPET_Implementation_2_MA to 360 Engage Direct.pptx
ssuser4ef83d
 
Developing Security Orchestration, Automation, and Response Applications
Developing Security Orchestration, Automation, and Response ApplicationsDeveloping Security Orchestration, Automation, and Response Applications
Developing Security Orchestration, Automation, and Response Applications
VICTOR MAESTRE RAMIREZ
 
GenAI for Quant Analytics: survey-analytics.ai
GenAI for Quant Analytics: survey-analytics.aiGenAI for Quant Analytics: survey-analytics.ai
GenAI for Quant Analytics: survey-analytics.ai
Inspirient
 
183409-christina-rossetti.pdfdsfsdasggsag
183409-christina-rossetti.pdfdsfsdasggsag183409-christina-rossetti.pdfdsfsdasggsag
183409-christina-rossetti.pdfdsfsdasggsag
fardin123rahman07
 
Safety Innovation in Mt. Vernon A Westchester County Model for New Rochelle a...
Safety Innovation in Mt. Vernon A Westchester County Model for New Rochelle a...Safety Innovation in Mt. Vernon A Westchester County Model for New Rochelle a...
Safety Innovation in Mt. Vernon A Westchester County Model for New Rochelle a...
James Francis Paradigm Asset Management
 
How iCode cybertech Helped Me Recover My Lost Funds
How iCode cybertech Helped Me Recover My Lost FundsHow iCode cybertech Helped Me Recover My Lost Funds
How iCode cybertech Helped Me Recover My Lost Funds
ireneschmid345
 
chapter 4 Variability statistical research .pptx
chapter 4 Variability statistical research .pptxchapter 4 Variability statistical research .pptx
chapter 4 Variability statistical research .pptx
justinebandajbn
 
Cleaned_Lecture 6666666_Simulation_I.pdf
Cleaned_Lecture 6666666_Simulation_I.pdfCleaned_Lecture 6666666_Simulation_I.pdf
Cleaned_Lecture 6666666_Simulation_I.pdf
alcinialbob1234
 
chapter3 Central Tendency statistics.ppt
chapter3 Central Tendency statistics.pptchapter3 Central Tendency statistics.ppt
chapter3 Central Tendency statistics.ppt
justinebandajbn
 
LLM finetuning for multiple choice google bert
LLM finetuning for multiple choice google bertLLM finetuning for multiple choice google bert
LLM finetuning for multiple choice google bert
ChadapornK
 
C++_OOPs_DSA1_Presentation_Template.pptx
C++_OOPs_DSA1_Presentation_Template.pptxC++_OOPs_DSA1_Presentation_Template.pptx
C++_OOPs_DSA1_Presentation_Template.pptx
aquibnoor22079
 
Deloitte Analytics - Applying Process Mining in an audit context
Deloitte Analytics - Applying Process Mining in an audit contextDeloitte Analytics - Applying Process Mining in an audit context
Deloitte Analytics - Applying Process Mining in an audit context
Process mining Evangelist
 
Flip flop presenation-Presented By Mubahir khan.pptx
Flip flop presenation-Presented By Mubahir khan.pptxFlip flop presenation-Presented By Mubahir khan.pptx
Flip flop presenation-Presented By Mubahir khan.pptx
mubashirkhan45461
 
IAS-slides2-ia-aaaaaaaaaaain-business.pdf
IAS-slides2-ia-aaaaaaaaaaain-business.pdfIAS-slides2-ia-aaaaaaaaaaain-business.pdf
IAS-slides2-ia-aaaaaaaaaaain-business.pdf
mcgardenlevi9
 
CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...
CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...
CTS EXCEPTIONSPrediction of Aluminium wire rod physical properties through AI...
ThanushsaranS
 
VKS-Python Basics for Beginners and advance.pptx
VKS-Python Basics for Beginners and advance.pptxVKS-Python Basics for Beginners and advance.pptx
VKS-Python Basics for Beginners and advance.pptx
Vinod Srivastava
 
Conic Sectionfaggavahabaayhahahahahs.pptx
Conic Sectionfaggavahabaayhahahahahs.pptxConic Sectionfaggavahabaayhahahahahs.pptx
Conic Sectionfaggavahabaayhahahahahs.pptx
taiwanesechetan
 
Defense Against LLM Scheming 2025_04_28.pptx
Defense Against LLM Scheming 2025_04_28.pptxDefense Against LLM Scheming 2025_04_28.pptx
Defense Against LLM Scheming 2025_04_28.pptx
Greg Makowski
 
DPR_Expert_Recruitment_notice_Revised.pdf
DPR_Expert_Recruitment_notice_Revised.pdfDPR_Expert_Recruitment_notice_Revised.pdf
DPR_Expert_Recruitment_notice_Revised.pdf
inmishra17121973
 
FPET_Implementation_2_MA to 360 Engage Direct.pptx
FPET_Implementation_2_MA to 360 Engage Direct.pptxFPET_Implementation_2_MA to 360 Engage Direct.pptx
FPET_Implementation_2_MA to 360 Engage Direct.pptx
ssuser4ef83d
 

SQL Joins.pptx

  • 2. Outline 1. WHAT IS SQL JOIN 2. WHY JOIN IS USED 3. TYPES OF SQL JOINS 4. SQL INNER JOIN 5. SQL OUTER JOIN 6. SQL LEFT JOIN 7. SQL RIGHT JOIN 7. SQL CROSS JOIN 7. SQL SELF JOIN Ankit Rai
  • 3. WHAT IS SQL JOIN SQL join combines rows from more than one table by using common column in both the tables. Ankit Rai
  • 4. WHY WE USE SQL JOIN?  Flexibility – It allows the user to access and manage records from more than one table.  Data Redundancy – SQL join allows us to keep data redundancy low so that we can reduce the amount of data anomalies.  Efficiency – Executes faster and shows results much more quickly than any other sub query. Ankit Rai
  • 5. TYPES OF JOINS 1 INNER JOIN 2 OUTER JOIN 3 LEFT JOIN 4 RIGHT JOIN 5 CROSS JOIN 6 SELF JOIN Ankit Rai
  • 6. INNER JOIN Inner join returns a new table by combining records that only have matching values in both the tables. SYNTAX SELECT table1.col_name, table2.col_name,…... FROM table1 INNER JOIN table2 ON table1.column = table2.column; Ankit Rai
  • 7. OUTER JOIN Outer join returns all those records which are in either the left table or right table. SYNTAX SELECT table1.col_name, table2.col_name,…... FROM table1 FULL OUTER JOIN table2 ON table1.column = table2.column; Ankit Rai
  • 8. LEFT JOIN Left join returns all the rows from the left table and matching rows from the right table. SYNTAX SELECT table1.col_name, table2.col_name,…... FROM table1 LEFT JOIN table2 ON table1.column = table2.column; Ankit Rai
  • 9. RIGHT JOIN Right join returns all the rows from the right table and all the matching records from the left table. SYNTAX SELECT table1.col_name, table2.col_name,…... FROM table1 RIGHT JOIN table2 ON table1.column = table2.column; Ankit Rai
  • 10. CROSS JOIN A cross join is a type of join that returns the Cartesian product of rows from the tables in the join. In other words, it combines each row from the first table with each row from the second table. SYNTAX SELECT table1.col_name, table2.col_name,…... FROM table1 CROSS JOIN table2 ON table1.column = table2.column; Ankit Rai
  • 11. SELF JOIN A self join is a join in which a table is joined with itself (which is also called unary relationship). To join a table itself means that each row of the table is combined with itself and with every other row of the table. SYNTAX SELECT column(s) FROM table1 t1, table1 t2 WHERE condition; Ankit Rai