SlideShare une entreprise Scribd logo
1  sur  29
INTRODUCTION TO SQL
WHAT ARE JOINS IN SQL?
TYPES OF JOINS
FAQs ABOUT JOINS
www.edureka.co/mysql-dba
www.edureka.co/mysql-dba
2.5 x 1018 Bytes
www.edureka.co/mysql-dba
SQLisastandardlanguagewhichstandsforStructuredQueryLanguage.SQListhecoreofrelationaldatabaseandis
usedforaccessingandmanagingdatabase.
IntroductiontoSQL
www.edureka.co/mysql-dba
Core of Relational
Databases
Database Administrators
www.edureka.co/mysql-dba
JOINSinSQLarecommandswhichareusedtocombinerowsfromtwoormoretables,basedonarelatedcolumn
betweenthosetables. Theyarepredominantlyusedwhenauseristryingtoextractdatafromtableswhichhaveone-
to-manyormany-to-manyrelationshipsbetweenthem.
WhatareJoinsinSQL?
www.edureka.co/mysql-dba
www.edureka.co/mysql-dba
TYPES OF
JOINS
www.edureka.co
INNER JOIN LEFT JOIN
RIGHT JOIN FULL JOIN
www.edureka.co/mysql-dba
TYPES OF
JOINS
INNER JOIN
Thistypeofjoinreturnsthoserecordswhichhavematchingvaluesinboth
tables.So,ifyouperformanINNERJOINoperationbetweentheEmployeetable
andtheProjectstable,allthetupleswhichhavematchingvaluesinboththe
tableswillbegivenasoutput.
Syntax:
SELECT Table1.Column1,Table1.Column2,Table2.Column1,....
FROM Table1
INNER JOIN Table2
ON Table1.MatchingColumnName = Table2.MatchingColumnName;
www.edureka.co/mysql-dba
TYPES OF
JOINS
www.edureka.co
INNER JOIN LEFT JOIN
RIGHT JOIN FULL JOIN
www.edureka.co/mysql-dba
TYPES OF
JOINS
LEFT JOIN
TheLEFTJOINortheLEFTOUTERJOIN returnsalltherecordsfromthelefttable
andalsothoserecordswhichsatisfyaconditionfromtherighttable.Also,for
therecordshavingnomatchingvaluesintherighttable,theoutputorthe
result-setwillcontaintheNULLvalues.
Syntax:
SELECT Table1.Column1,Table1.Column2,Table2.Column1,....
FROM Table1
LEFT JOIN Table2
ON Table1.MatchingColumnName = Table2.MatchingColumnName;
SELECT Table1.Column1,Table1.Column2,Table2.Column1,.... FROM Table1 LEFT JOIN Table2 ON Table1.MatchingColumnName = Table2.MatchingColumnName;
www.edureka.co/mysql-dba
TYPES OF
JOINS
www.edureka.co
INNER JOIN LEFT JOIN
RIGHT JOIN FULL JOIN
www.edureka.co/mysql-dba
TYPES OF
JOINS
RIGHT JOIN
TheRIGHTJOINortheRIGHTOUTERJOIN returnsalltherecordsfromtheright
tableandalsothoserecordswhichsatisfyaconditionfromthelefttable.Also,
fortherecordshavingnomatchingvaluesinthelefttable,theoutputorthe
result-setwillcontaintheNULLvalues.
Syntax:
SELECT Table1.Column1,Table1.Column2,Table2.Column1,....
FROM Table1
RIGHT JOIN Table2
ON Table1.MatchingColumnName = Table2.MatchingColumnName;
SELECT Table1.Column1,Table1.Column2,Table2.Column1,.... FROM Table1 RIGHT JOIN Table2 ON Table1.MatchingColumnName = Table2.MatchingColumnName;
www.edureka.co/mysql-dba
TYPES OF
JOINS
www.edureka.co
INNER JOIN LEFT JOIN
RIGHT JOIN FULL JOIN
www.edureka.co/mysql-dba
TYPES OF
JOINS
www.edureka.co
FULL JOIN
FullJoinortheFullOuterJoinreturnsallthoserecordswhicheitherhavea
matchintheleft(Table1)ortheright(Table2)table.
Syntax:
SELECT Table1.Column1,Table1.Column2,Table2.Column1,....
FROM Table1
FULL JOIN Table2
ON Table1.MatchingColumnName = Table2.MatchingColumnName;
www.edureka.co/mysql-dba
TYPES OF
JOINS
www.edureka.co
INNER JOIN LEFT JOIN
RIGHT JOIN FULL JOIN
www.edureka.co/mysql-dba
www.edureka.co/mysql-dba
What is a Natural Join and in which situations
is a Natural Join used?
www.edureka.co/mysql-dba
What is a Natural Join and in which situations is a Natural
Join used?
www.edureka.co/mysql-dba
Output when you apply
INNER JOIN
Output when you apply
NATURAL JOIN
How to map many-to-many relationships
using joins?
www.edureka.co/mysql-dba
How to map many-to-many relationships using joins?
www.edureka.co/mysql-dba
Projects Technologies Projects_to_Technologies
2JOIN statements
What is a Hash Join?
www.edureka.co/mysql-dba
What is a Hash Join?
www.edureka.co/mysql-dba
Hash Joins are also a type of joins which are used to join large tables or in an instance,
where the user wants most of the joined table rows.
The Hash Join algorithm is a two-step algorithm.
Build Phase Probe Phase
What is Self & Cross Join?
www.edureka.co/mysql-dba
What is Self & Cross Join?
www.edureka.co/mysql-dba
SELF JOIN in is a join of a table to itself. This implies that each row in a table is joined
with itself.
The CROSS JOIN is a type of join in which a join clause is applied to each row of a table to
every row of the other table. Also, when the WHERE condition is used, this type of JOIN
behaves as an INNER JOIN, and when the WHERE condition is not present, it behaves like a
CARTESIAN product..
Self Join
Cross Join
How to perform JOIN operation on three
tables?
www.edureka.co/mysql-dba
How to perform JOIN operation on three tables?
www.edureka.co/mysql-dba
To perform a JOIN operation on 3 tables, you
need to use 2 JOIN statements.
www.edureka.co/mysql-dba

Contenu connexe

Tendances

Tendances (20)

SQL Joins.pptx
SQL Joins.pptxSQL Joins.pptx
SQL Joins.pptx
 
SQL Tutorial - Basic Commands
SQL Tutorial - Basic CommandsSQL Tutorial - Basic Commands
SQL Tutorial - Basic Commands
 
Sql server windowing functions
Sql server windowing functionsSql server windowing functions
Sql server windowing functions
 
Top 65 SQL Interview Questions and Answers | Edureka
Top 65 SQL Interview Questions and Answers | EdurekaTop 65 SQL Interview Questions and Answers | Edureka
Top 65 SQL Interview Questions and Answers | Edureka
 
SQL JOIN
SQL JOINSQL JOIN
SQL JOIN
 
Working with Databases and MySQL
Working with Databases and MySQLWorking with Databases and MySQL
Working with Databases and MySQL
 
MySQL
MySQLMySQL
MySQL
 
Joins in SQL
Joins in SQLJoins in SQL
Joins in SQL
 
MySQL JOINS
MySQL JOINSMySQL JOINS
MySQL JOINS
 
Oracle SQL Basics
Oracle SQL BasicsOracle SQL Basics
Oracle SQL Basics
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
 
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
 
SQL(DDL & DML)
SQL(DDL & DML)SQL(DDL & DML)
SQL(DDL & DML)
 
SQL for interview
SQL for interviewSQL for interview
SQL for interview
 
SQL select clause
SQL select clauseSQL select clause
SQL select clause
 
SQL Join Basic
SQL Join BasicSQL Join Basic
SQL Join Basic
 
Introduction to-sql
Introduction to-sqlIntroduction to-sql
Introduction to-sql
 
Aggregate function
Aggregate functionAggregate function
Aggregate function
 
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
 
Introduction to SQL
Introduction to SQLIntroduction to SQL
Introduction to SQL
 

Similaire à SQL Joins With Examples | Edureka

Sql interview question part 12
Sql interview question part 12Sql interview question part 12
Sql interview question part 12
kaashiv1
 
Sql interview question part 3
Sql interview question part 3Sql interview question part 3
Sql interview question part 3
kaashiv1
 
Introduction to sql server
Introduction to sql serverIntroduction to sql server
Introduction to sql server
Vinay Thota
 
Sql Interview Questions
Sql Interview QuestionsSql Interview Questions
Sql Interview Questions
arjundwh
 

Similaire à SQL Joins With Examples | Edureka (20)

GROUP-4-Database-Connectivity-with-MySqL.pptx
GROUP-4-Database-Connectivity-with-MySqL.pptxGROUP-4-Database-Connectivity-with-MySqL.pptx
GROUP-4-Database-Connectivity-with-MySqL.pptx
 
Sql interview question part 12
Sql interview question part 12Sql interview question part 12
Sql interview question part 12
 
Ebook12
Ebook12Ebook12
Ebook12
 
Sql interview question part 12
Sql interview question part 12Sql interview question part 12
Sql interview question part 12
 
LinkedList vs ArrayList in Java | Edureka
LinkedList vs ArrayList in Java | EdurekaLinkedList vs ArrayList in Java | Edureka
LinkedList vs ArrayList in Java | Edureka
 
Mysql
MysqlMysql
Mysql
 
Ebook3
Ebook3Ebook3
Ebook3
 
Sql interview question part 3
Sql interview question part 3Sql interview question part 3
Sql interview question part 3
 
Ebook7
Ebook7Ebook7
Ebook7
 
Sql interview question part 7
Sql interview question part 7Sql interview question part 7
Sql interview question part 7
 
Mysql
MysqlMysql
Mysql
 
Introduction to sql server
Introduction to sql serverIntroduction to sql server
Introduction to sql server
 
MYSQL.ppt
MYSQL.pptMYSQL.ppt
MYSQL.ppt
 
My sql vs sql
My sql vs sqlMy sql vs sql
My sql vs sql
 
SQL vs NoSQL | MySQL vs MongoDB Tutorial | Edureka
SQL vs NoSQL | MySQL vs MongoDB Tutorial | EdurekaSQL vs NoSQL | MySQL vs MongoDB Tutorial | Edureka
SQL vs NoSQL | MySQL vs MongoDB Tutorial | Edureka
 
Access
AccessAccess
Access
 
Sql
SqlSql
Sql
 
Sql Interview Questions
Sql Interview QuestionsSql Interview Questions
Sql Interview Questions
 
Sql
SqlSql
Sql
 
Sql
SqlSql
Sql
 

Plus de Edureka!

Plus de Edureka! (20)

What to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | EdurekaWhat to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | Edureka
 
Top 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | EdurekaTop 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
 
Top 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | EdurekaTop 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaTableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | Edureka
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaPython Programming Tutorial | Edureka
Python Programming Tutorial | Edureka
 
Top 5 PMP Certifications | Edureka
Top 5 PMP Certifications | EdurekaTop 5 PMP Certifications | Edureka
Top 5 PMP Certifications | Edureka
 
Top Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | EdurekaTop Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | Edureka
 
Linux Mint Tutorial | Edureka
Linux Mint Tutorial | EdurekaLinux Mint Tutorial | Edureka
Linux Mint Tutorial | Edureka
 
How to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| EdurekaHow to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| Edureka
 
Importance of Digital Marketing | Edureka
Importance of Digital Marketing | EdurekaImportance of Digital Marketing | Edureka
Importance of Digital Marketing | Edureka
 
RPA in 2020 | Edureka
RPA in 2020 | EdurekaRPA in 2020 | Edureka
RPA in 2020 | Edureka
 
Email Notifications in Jenkins | Edureka
Email Notifications in Jenkins | EdurekaEmail Notifications in Jenkins | Edureka
Email Notifications in Jenkins | Edureka
 
EA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | EdurekaEA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | Edureka
 
Cognitive AI Tutorial | Edureka
Cognitive AI Tutorial | EdurekaCognitive AI Tutorial | Edureka
Cognitive AI Tutorial | Edureka
 
AWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | EdurekaAWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
 
Blue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | EdurekaBlue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | Edureka
 
Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | EdurekaA star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
 
Kubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | EdurekaKubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | Edureka
 
Introduction to DevOps | Edureka
Introduction to DevOps | EdurekaIntroduction to DevOps | Edureka
Introduction to DevOps | Edureka
 

Dernier

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Dernier (20)

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

SQL Joins With Examples | Edureka