SlideShare a Scribd company logo
1 of 17
Prepared by;
name en.number
• Vikram rajpurohit 140500116033
• Taxak mistery 140500116016
• Paras patel 140500116024
SQL Joins
SQL joins are used to get data from two or more
tables bases on relationship between some of the
columns in tables.
In most of the cases we will use primary key of
first table and foreign key of secondary table to
get data from tables
TYPES OF JOIN
Tables for examples
EMPNO ENAME JOB MGR DEPTNO
111 Ramesh Analyst 444 10
222 Khilan Clerk 333 20
333 Kaushik Manager 111 10
444 Chaitali engineer 222 40
DEPTNO DNAME LOC
10 INVENTORY HYDERABAD
20 FINANCE BANGALORE
30 HR MUMBAI
INNER JOIN OR EQUIJOIN
clause is used to combine rows from two or more tables, based on a
common field between them.
INNER JOIN creates a new result table by combining column values of
two tables (table1 and table2) based upon the join-condition.
Keyword used is INNER JOIN or simply JOIN.
INNER JOIN OR EQUIJOIN
Syntax SELECT table1.column1, table2.column2...
FROM table1 INNER JOIN table2 ON
table1.common_field = table2.common_field;
SELECT emp.ename,emp.job,dept.dname,dept.loc from EMPLOYYE emp
INNER JOIN DEPARTMENT dept ON emp.deptno = dept.deptno;
Result……
ENAME JOB DNAME LOC
Ramesh Analyst INVENTORY HYDERABAD
Khilan Clerk FINANCE BANGALORE
Kaushik Manager INVENTORY HYDERABAD
Left Join/Left Outer Join
LEFT JOIN returns all rows from the left table (table1),
even if there are no matches in the right table(table2).
If there are no matches found in right table the result is
null in the right table.
Keyword used is LEFT JOIN.
Left Join Continuation…
Syntax  SELECT table1.column1, table2.column2... FROM table1
LEFT JOIN table2 ON table1.common_field =
table2.common_field;
SELECT emp.ename,emp.job,dept.dname,dept.loc from EMPLOYYE emp
LEFT JOIN DEPARTMENT dept ON emp.deptno = dept.deptno;
OR
SELECT emp.ename,emp.job,dept.dname,dept.loc from EMPLOYYE emp ,
DEPARTMENT dept WHERE emp.deptno(+) = dept.deptno;
ENAME JOB DNAME LOC
Ramesh Analyst INVENTORY HYDERABAD
Khilan Clerk FINANCE BANGALORE
Kaushik Manager INVENTORY HYDERABAD
Chaitali engineer NULL NULL
Right Join/Right Outer Join
RIGHT JOIN returns all rows from the right table (table2),
even if there are no matches in the left table(table1).
If there are no matched found in let table the result is null
in the left table.
Keyword used is RIGHT JOIN.
Right Join Continuation…
Syntax  SELECT table1.column1, table2.column2... FROM table1
RIGHT JOIN table2 ON table1.common_field =
table2.common_field;
SELECT emp.ename,emp.job,dept.dname,dept.loc from EMPLOYYE emp
RIGHT JOIN DEPARTMENT dept ON emp.deptno = dept.deptno;
OR
SELECT emp.ename,emp.job,dept.dname,dept.loc from EMPLOYYE emp,
DEPARTMENT dept WHERE emp.deptno = dept.deptno(+);
ENAME JOB DNAME LOC
Ramesh Analyst INVENTORY HYDERABAD
Khilan Clerk FINANCE BANGALORE
Kaushik Manager INVENTORY HYDERABAD
NULL NULL HR MUMBAI
Full Join
The SQL FULL JOIN combines the results of both left and
right outer joins.
The joined table will contain all records from both tables,
and fill in NULLs for missing matches on either side.
Keyword used is FULL JOIN. In some data bases it is also
known as FULL OUTER JOIN.
Full Join Continuation…
Syntax  SELECT table1.column1, table2.column2... FROM table1
FULL JOIN table2 ON table1.common_field =
table2.common_field;
SELECT emp.ename,emp.job,dept.dname,dept.loc from EMPLOYYE emp
FULL JOIN DEPARTMENT dept ON emp.deptno = dept.deptno;
ENAME JOB DNAME LOC
Ramesh Analyst INVENTORY HYDERABAD
Khilan Clerk FINANCE BANGALORE
Kaushik Manager INVENTORY HYDERABAD
NULL NULL HR MUMBAI
Chaitali engineer NULL NULL
Self Join
SELF JOIN is used to join a table to itself as if the
table were two tables
Syntax  SELECT a.column_name, b.column_name... FROM
table1 a, table1 b WHERE a.common_field = b.common_field;
Self Join Continuation….
SELECT emp1.ename, emp1.job, emp2.ename as
manager FROM EMPLOYEE emp1, EMPLOYEE
emp2 where emp1.mgr = emp2.empno;
ENAME JOB MANAGER
Ramesh Analyst Chaitali
Khilan Clerk Kaushik
Kaushik Manager Ramesh
Chaitali engineer Khilan
 types of SQL Joins

More Related Content

What's hot

Using Excel Functions
Using Excel FunctionsUsing Excel Functions
Using Excel FunctionsGautam Gupta
 
10 Excel Formulas that will help you in any Job
10 Excel Formulas that will help you in any Job10 Excel Formulas that will help you in any Job
10 Excel Formulas that will help you in any JobHitesh Biyani
 
VLOOKUP HLOOKUP INDEX MATCH
VLOOKUP HLOOKUP INDEX MATCHVLOOKUP HLOOKUP INDEX MATCH
VLOOKUP HLOOKUP INDEX MATCHMridul Bansal
 
How to use Hlookup find an exact match
How to use Hlookup find an exact match How to use Hlookup find an exact match
How to use Hlookup find an exact match Excel Advise
 
Excel basics for everyday use part three
Excel basics for everyday use part threeExcel basics for everyday use part three
Excel basics for everyday use part threeKevin McLogan
 
Microsoft Excel VLOOKUP Function
Microsoft Excel VLOOKUP FunctionMicrosoft Excel VLOOKUP Function
Microsoft Excel VLOOKUP FunctionExcel
 
Excel functions formulas
Excel functions formulasExcel functions formulas
Excel functions formulasLearnIT@UD
 
Lesson 2.1 what is a function
Lesson 2.1    what is a functionLesson 2.1    what is a function
Lesson 2.1 what is a functionDreams4school
 
On if,countif,countifs,sumif,countifs,lookup,v lookup,index,match
On if,countif,countifs,sumif,countifs,lookup,v lookup,index,matchOn if,countif,countifs,sumif,countifs,lookup,v lookup,index,match
On if,countif,countifs,sumif,countifs,lookup,v lookup,index,matchRakesh Sah
 
VLOOKUP Function - Marelen Talavera - Vivacious Analytic
VLOOKUP Function - Marelen Talavera - Vivacious AnalyticVLOOKUP Function - Marelen Talavera - Vivacious Analytic
VLOOKUP Function - Marelen Talavera - Vivacious AnalyticMaria Elena Acdol-Talavera
 
How to use vlookup in MS Excel
How to use vlookup in MS ExcelHow to use vlookup in MS Excel
How to use vlookup in MS ExcelJaspal Singh
 

What's hot (20)

Joins
JoinsJoins
Joins
 
Sql join
Sql  joinSql  join
Sql join
 
Using Excel Functions
Using Excel FunctionsUsing Excel Functions
Using Excel Functions
 
SQL JOINS- Reena P V
SQL JOINS- Reena P VSQL JOINS- Reena P V
SQL JOINS- Reena P V
 
Sql joins
Sql joinsSql joins
Sql joins
 
10 Excel Formulas that will help you in any Job
10 Excel Formulas that will help you in any Job10 Excel Formulas that will help you in any Job
10 Excel Formulas that will help you in any Job
 
Join
JoinJoin
Join
 
joins in database
 joins in database joins in database
joins in database
 
Mastering Excel Formulas and Functions
Mastering Excel Formulas and FunctionsMastering Excel Formulas and Functions
Mastering Excel Formulas and Functions
 
VLOOKUP HLOOKUP INDEX MATCH
VLOOKUP HLOOKUP INDEX MATCHVLOOKUP HLOOKUP INDEX MATCH
VLOOKUP HLOOKUP INDEX MATCH
 
How to use Hlookup find an exact match
How to use Hlookup find an exact match How to use Hlookup find an exact match
How to use Hlookup find an exact match
 
Formula in MS Excel
Formula in MS ExcelFormula in MS Excel
Formula in MS Excel
 
Sql joins
Sql joinsSql joins
Sql joins
 
Excel basics for everyday use part three
Excel basics for everyday use part threeExcel basics for everyday use part three
Excel basics for everyday use part three
 
Microsoft Excel VLOOKUP Function
Microsoft Excel VLOOKUP FunctionMicrosoft Excel VLOOKUP Function
Microsoft Excel VLOOKUP Function
 
Excel functions formulas
Excel functions formulasExcel functions formulas
Excel functions formulas
 
Lesson 2.1 what is a function
Lesson 2.1    what is a functionLesson 2.1    what is a function
Lesson 2.1 what is a function
 
On if,countif,countifs,sumif,countifs,lookup,v lookup,index,match
On if,countif,countifs,sumif,countifs,lookup,v lookup,index,matchOn if,countif,countifs,sumif,countifs,lookup,v lookup,index,match
On if,countif,countifs,sumif,countifs,lookup,v lookup,index,match
 
VLOOKUP Function - Marelen Talavera - Vivacious Analytic
VLOOKUP Function - Marelen Talavera - Vivacious AnalyticVLOOKUP Function - Marelen Talavera - Vivacious Analytic
VLOOKUP Function - Marelen Talavera - Vivacious Analytic
 
How to use vlookup in MS Excel
How to use vlookup in MS ExcelHow to use vlookup in MS Excel
How to use vlookup in MS Excel
 

Similar to types of SQL Joins

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 analysisSanSan149
 
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 JoinSouma Maiti
 
Assignment 4
Assignment 4Assignment 4
Assignment 4SneaK3
 
Sql(structured query language)
Sql(structured query language)Sql(structured query language)
Sql(structured query language)Ishucs
 
MS SQL SERVER: Joining Databases
MS SQL SERVER: Joining DatabasesMS SQL SERVER: Joining Databases
MS SQL SERVER: Joining Databasessqlserver content
 
MS SQLSERVER:Joining Databases
MS SQLSERVER:Joining DatabasesMS SQLSERVER:Joining Databases
MS SQLSERVER:Joining Databasessqlserver content
 
Sql server ___________session_11-12(joins)
Sql server  ___________session_11-12(joins)Sql server  ___________session_11-12(joins)
Sql server ___________session_11-12(joins)Ehtisham Ali
 
Lesson 6 - Relational Algebra.pdf
Lesson 6 - Relational Algebra.pdfLesson 6 - Relational Algebra.pdf
Lesson 6 - Relational Algebra.pdfHasankaWijesinghe1
 
SQL Joins.pptx
SQL Joins.pptxSQL Joins.pptx
SQL Joins.pptxAnkit Rai
 

Similar to types of SQL Joins (20)

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
 
Joins in SQL
Joins in SQLJoins in SQL
Joins in SQL
 
V19 join method-c
V19 join method-cV19 join method-c
V19 join method-c
 
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
 
Assignment 4
Assignment 4Assignment 4
Assignment 4
 
JOINS.pptx
JOINS.pptxJOINS.pptx
JOINS.pptx
 
Sql(structured query language)
Sql(structured query language)Sql(structured query language)
Sql(structured query language)
 
database .pptx
database .pptxdatabase .pptx
database .pptx
 
Lab4 join - all types listed
Lab4   join - all types listedLab4   join - all types listed
Lab4 join - all types listed
 
MS SQL SERVER: Joining Databases
MS SQL SERVER: Joining DatabasesMS SQL SERVER: Joining Databases
MS SQL SERVER: Joining Databases
 
MS SQLSERVER:Joining Databases
MS SQLSERVER:Joining DatabasesMS SQLSERVER:Joining Databases
MS SQLSERVER:Joining Databases
 
Joining
JoiningJoining
Joining
 
Oracle: Joins
Oracle: JoinsOracle: Joins
Oracle: Joins
 
SQL JOINS
SQL JOINSSQL JOINS
SQL JOINS
 
Sql server ___________session_11-12(joins)
Sql server  ___________session_11-12(joins)Sql server  ___________session_11-12(joins)
Sql server ___________session_11-12(joins)
 
SQL JOIN.pptx
SQL JOIN.pptxSQL JOIN.pptx
SQL JOIN.pptx
 
Les04
Les04Les04
Les04
 
Join query
Join queryJoin query
Join query
 
Lesson 6 - Relational Algebra.pdf
Lesson 6 - Relational Algebra.pdfLesson 6 - Relational Algebra.pdf
Lesson 6 - Relational Algebra.pdf
 
SQL Joins.pptx
SQL Joins.pptxSQL Joins.pptx
SQL Joins.pptx
 

More from vikram rajpurohit

Factors of Production (economics)
Factors of Production (economics)Factors of Production (economics)
Factors of Production (economics)vikram rajpurohit
 
encoder and decoder in digital electronics
encoder and decoder in digital electronicsencoder and decoder in digital electronics
encoder and decoder in digital electronicsvikram rajpurohit
 
INTRODUCTION TO ECONOMICS(Microeconomics vs. Macroeconomics)
INTRODUCTION TO ECONOMICS(Microeconomics vs. Macroeconomics)INTRODUCTION TO ECONOMICS(Microeconomics vs. Macroeconomics)
INTRODUCTION TO ECONOMICS(Microeconomics vs. Macroeconomics)vikram rajpurohit
 
Circuit protection devices perfect ppt
Circuit protection devices perfect ppt Circuit protection devices perfect ppt
Circuit protection devices perfect ppt vikram rajpurohit
 

More from vikram rajpurohit (6)

Factors of Production (economics)
Factors of Production (economics)Factors of Production (economics)
Factors of Production (economics)
 
encoder and decoder in digital electronics
encoder and decoder in digital electronicsencoder and decoder in digital electronics
encoder and decoder in digital electronics
 
INTRODUCTION TO ECONOMICS(Microeconomics vs. Macroeconomics)
INTRODUCTION TO ECONOMICS(Microeconomics vs. Macroeconomics)INTRODUCTION TO ECONOMICS(Microeconomics vs. Macroeconomics)
INTRODUCTION TO ECONOMICS(Microeconomics vs. Macroeconomics)
 
FUNCTIONS OF MANAGEMENT
FUNCTIONS OFMANAGEMENTFUNCTIONS OFMANAGEMENT
FUNCTIONS OF MANAGEMENT
 
Circuit protection devices
Circuit protection devicesCircuit protection devices
Circuit protection devices
 
Circuit protection devices perfect ppt
Circuit protection devices perfect ppt Circuit protection devices perfect ppt
Circuit protection devices perfect ppt
 

Recently uploaded

High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSCAESB
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 

Recently uploaded (20)

High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
GDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentationGDSC ASEB Gen AI study jams presentation
GDSC ASEB Gen AI study jams presentation
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 

types of SQL Joins

  • 1.
  • 2. Prepared by; name en.number • Vikram rajpurohit 140500116033 • Taxak mistery 140500116016 • Paras patel 140500116024
  • 3. SQL Joins SQL joins are used to get data from two or more tables bases on relationship between some of the columns in tables. In most of the cases we will use primary key of first table and foreign key of secondary table to get data from tables
  • 5. Tables for examples EMPNO ENAME JOB MGR DEPTNO 111 Ramesh Analyst 444 10 222 Khilan Clerk 333 20 333 Kaushik Manager 111 10 444 Chaitali engineer 222 40 DEPTNO DNAME LOC 10 INVENTORY HYDERABAD 20 FINANCE BANGALORE 30 HR MUMBAI
  • 6. INNER JOIN OR EQUIJOIN clause is used to combine rows from two or more tables, based on a common field between them. INNER JOIN creates a new result table by combining column values of two tables (table1 and table2) based upon the join-condition. Keyword used is INNER JOIN or simply JOIN.
  • 7. INNER JOIN OR EQUIJOIN Syntax SELECT table1.column1, table2.column2... FROM table1 INNER JOIN table2 ON table1.common_field = table2.common_field; SELECT emp.ename,emp.job,dept.dname,dept.loc from EMPLOYYE emp INNER JOIN DEPARTMENT dept ON emp.deptno = dept.deptno;
  • 8. Result…… ENAME JOB DNAME LOC Ramesh Analyst INVENTORY HYDERABAD Khilan Clerk FINANCE BANGALORE Kaushik Manager INVENTORY HYDERABAD
  • 9. Left Join/Left Outer Join LEFT JOIN returns all rows from the left table (table1), even if there are no matches in the right table(table2). If there are no matches found in right table the result is null in the right table. Keyword used is LEFT JOIN.
  • 10. Left Join Continuation… Syntax  SELECT table1.column1, table2.column2... FROM table1 LEFT JOIN table2 ON table1.common_field = table2.common_field; SELECT emp.ename,emp.job,dept.dname,dept.loc from EMPLOYYE emp LEFT JOIN DEPARTMENT dept ON emp.deptno = dept.deptno; OR SELECT emp.ename,emp.job,dept.dname,dept.loc from EMPLOYYE emp , DEPARTMENT dept WHERE emp.deptno(+) = dept.deptno; ENAME JOB DNAME LOC Ramesh Analyst INVENTORY HYDERABAD Khilan Clerk FINANCE BANGALORE Kaushik Manager INVENTORY HYDERABAD Chaitali engineer NULL NULL
  • 11. Right Join/Right Outer Join RIGHT JOIN returns all rows from the right table (table2), even if there are no matches in the left table(table1). If there are no matched found in let table the result is null in the left table. Keyword used is RIGHT JOIN.
  • 12. Right Join Continuation… Syntax  SELECT table1.column1, table2.column2... FROM table1 RIGHT JOIN table2 ON table1.common_field = table2.common_field; SELECT emp.ename,emp.job,dept.dname,dept.loc from EMPLOYYE emp RIGHT JOIN DEPARTMENT dept ON emp.deptno = dept.deptno; OR SELECT emp.ename,emp.job,dept.dname,dept.loc from EMPLOYYE emp, DEPARTMENT dept WHERE emp.deptno = dept.deptno(+); ENAME JOB DNAME LOC Ramesh Analyst INVENTORY HYDERABAD Khilan Clerk FINANCE BANGALORE Kaushik Manager INVENTORY HYDERABAD NULL NULL HR MUMBAI
  • 13. Full Join The SQL FULL JOIN combines the results of both left and right outer joins. The joined table will contain all records from both tables, and fill in NULLs for missing matches on either side. Keyword used is FULL JOIN. In some data bases it is also known as FULL OUTER JOIN.
  • 14. Full Join Continuation… Syntax  SELECT table1.column1, table2.column2... FROM table1 FULL JOIN table2 ON table1.common_field = table2.common_field; SELECT emp.ename,emp.job,dept.dname,dept.loc from EMPLOYYE emp FULL JOIN DEPARTMENT dept ON emp.deptno = dept.deptno; ENAME JOB DNAME LOC Ramesh Analyst INVENTORY HYDERABAD Khilan Clerk FINANCE BANGALORE Kaushik Manager INVENTORY HYDERABAD NULL NULL HR MUMBAI Chaitali engineer NULL NULL
  • 15. Self Join SELF JOIN is used to join a table to itself as if the table were two tables Syntax  SELECT a.column_name, b.column_name... FROM table1 a, table1 b WHERE a.common_field = b.common_field;
  • 16. Self Join Continuation…. SELECT emp1.ename, emp1.job, emp2.ename as manager FROM EMPLOYEE emp1, EMPLOYEE emp2 where emp1.mgr = emp2.empno; ENAME JOB MANAGER Ramesh Analyst Chaitali Khilan Clerk Kaushik Kaushik Manager Ramesh Chaitali engineer Khilan