SlideShare a Scribd company logo
1 of 11
SQL Joins
Presents by Bilal Bhatti
E-ID E-name Address
01 ABID CHTRAL
02 AZAM SIALKOT
03 BILAL GUJRAT
Employee
D-no D-name E-ID
145 HR 01
432 Admin 02
301 IT 03
Department
Must have
common attribute
JOIN=cross product+conditions
 Natural
 Self
 Equi
E-ID E-name Address
01 ABID CHTRAL
02 AZAM SIALKOT
03 BILAL GUJRAT
04 ATIF LHR
D-no D-name E-ID
D1 HR 01
D2 Admin 02
D3 CS 04
Department
Employee
Find the E-names who is working in a department..?
E-ID E-name Address D-no D-name E-ID
01 ABID CHTRAL D1 HR 01
01 ABID CHTRAL D2 Admin 02
01 ABID CHTRAL D3 CS 04
02 AZAM SIALKOT D1 HR 01
O2 AZAM SIALKOT D2 Admin 02
02 AZAM SIALKOT D3 CS 04
O3 BILAL GUJRAT D1 HR 01
03 BILAL GUJRAT D2 Admin 02
03 BILAL GUJRAT D3 CS 04
O4 ATIF LHR D1 HR 01
04 ATIF LHR D2 Admin 02
04 ATIF LHR D3 CS 04
Matrix
rule
m*n
Select E-name from Employee , Department where emp.E-id=Dept.E-id
E-ID E-name Address D-no D-name E-ID
01 ABID CHTRAL D1 HR 01
02 AZAM SIALKOT D2 Admin 02
04 ATIF LHR D3 CS 04
Select E-name from Employee
Natural join Department;
S-id C-id Year
S1 C1 2017
S2 C2 2018
S3 C3 2019
Student SELECT T1.S-id FROM Student as T1,
Student as T2
Where T1.S-id=T2.S-id
And
T1 C-id<>T2.C-id
Biodata Marks record
Select E-name from Employee , Department
where emp.E-id=Dept.E-id
And
Emp.address=Dept.campus
Concept of same attributes doesn’t matter in equi
 It is also known as right join
 It is similar to left outer join
 It gives the matching rows and the rows
which are in right table but not in left table
 In venn diagram it is represent as given below
Emp Dept
Dept-No Dept-
name
Location
D1 IT Lahore
D2 SE Sialkot
D3 CS Islamabad
D4 Math Lahore
Emp-no Emp-
name
Dept-No
Emp1 Azam D1
Emp2 Bilal D2
Emp3 Fahad D3
SelectEmp-no,Emp-name,Dept-name,Loc FromEmpRight
outer join Dept
On Emp.Deptno=Dept.Deptno
Employe no Employe name Dept name Location
Emp1 Azam IT Lahore
Emp2 Bilal SE Sialkot
Emp3 Fahad CS IslaMABAD
- - Math Lahore

More Related Content

Recently uploaded

CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)
Wonjun Hwang
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
FIDO Alliance
 

Recently uploaded (20)

Intro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptxIntro to Passkeys and the State of Passwordless.pptx
Intro to Passkeys and the State of Passwordless.pptx
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
 
CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)CORS (Kitworks Team Study 양다윗 발표자료 240510)
CORS (Kitworks Team Study 양다윗 발표자료 240510)
 
Microsoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - QuestionnaireMicrosoft CSP Briefing Pre-Engagement - Questionnaire
Microsoft CSP Briefing Pre-Engagement - Questionnaire
 
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Navigating the Large Language Model choices_Ravi Daparthi
Navigating the Large Language Model choices_Ravi DaparthiNavigating the Large Language Model choices_Ravi Daparthi
Navigating the Large Language Model choices_Ravi Daparthi
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
Generative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdfGenerative AI Use Cases and Applications.pdf
Generative AI Use Cases and Applications.pdf
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
The Ultimate Prompt Engineering Guide for Generative AI: Get the Most Out of ...
 
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdfFrisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
Frisco Automating Purchase Orders with MuleSoft IDP- May 10th, 2024.pptx.pdf
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
Design and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data ScienceDesign and Development of a Provenance Capture Platform for Data Science
Design and Development of a Provenance Capture Platform for Data Science
 
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptxHarnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
Harnessing Passkeys in the Battle Against AI-Powered Cyber Threats.pptx
 
Event-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream ProcessingEvent-Driven Architecture Masterclass: Challenges in Stream Processing
Event-Driven Architecture Masterclass: Challenges in Stream Processing
 

Featured

Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 

Sql joins

  • 1. SQL Joins Presents by Bilal Bhatti
  • 2. E-ID E-name Address 01 ABID CHTRAL 02 AZAM SIALKOT 03 BILAL GUJRAT Employee D-no D-name E-ID 145 HR 01 432 Admin 02 301 IT 03 Department Must have common attribute JOIN=cross product+conditions
  • 4. E-ID E-name Address 01 ABID CHTRAL 02 AZAM SIALKOT 03 BILAL GUJRAT 04 ATIF LHR D-no D-name E-ID D1 HR 01 D2 Admin 02 D3 CS 04 Department Employee Find the E-names who is working in a department..?
  • 5. E-ID E-name Address D-no D-name E-ID 01 ABID CHTRAL D1 HR 01 01 ABID CHTRAL D2 Admin 02 01 ABID CHTRAL D3 CS 04 02 AZAM SIALKOT D1 HR 01 O2 AZAM SIALKOT D2 Admin 02 02 AZAM SIALKOT D3 CS 04 O3 BILAL GUJRAT D1 HR 01 03 BILAL GUJRAT D2 Admin 02 03 BILAL GUJRAT D3 CS 04 O4 ATIF LHR D1 HR 01 04 ATIF LHR D2 Admin 02 04 ATIF LHR D3 CS 04 Matrix rule m*n Select E-name from Employee , Department where emp.E-id=Dept.E-id
  • 6. E-ID E-name Address D-no D-name E-ID 01 ABID CHTRAL D1 HR 01 02 AZAM SIALKOT D2 Admin 02 04 ATIF LHR D3 CS 04 Select E-name from Employee Natural join Department;
  • 7. S-id C-id Year S1 C1 2017 S2 C2 2018 S3 C3 2019 Student SELECT T1.S-id FROM Student as T1, Student as T2 Where T1.S-id=T2.S-id And T1 C-id<>T2.C-id Biodata Marks record
  • 8. Select E-name from Employee , Department where emp.E-id=Dept.E-id And Emp.address=Dept.campus Concept of same attributes doesn’t matter in equi
  • 9.  It is also known as right join  It is similar to left outer join  It gives the matching rows and the rows which are in right table but not in left table  In venn diagram it is represent as given below
  • 10. Emp Dept Dept-No Dept- name Location D1 IT Lahore D2 SE Sialkot D3 CS Islamabad D4 Math Lahore Emp-no Emp- name Dept-No Emp1 Azam D1 Emp2 Bilal D2 Emp3 Fahad D3 SelectEmp-no,Emp-name,Dept-name,Loc FromEmpRight outer join Dept On Emp.Deptno=Dept.Deptno
  • 11. Employe no Employe name Dept name Location Emp1 Azam IT Lahore Emp2 Bilal SE Sialkot Emp3 Fahad CS IslaMABAD - - Math Lahore