SlideShare a Scribd company logo
SQL JOINS
http://msbitutor.blogspot.com
2
SQL JOINS
Inner Join
Outer Join
Cross Join
3
SQL JOINS
I.INNER JOIN
Inner join returns only those records that match in both the tables.
Syntax:
Select * from table 1 INNER JOIN
table 2
ON
Table 1.Column 1=table 2.Column 1
4
SQL JOINS
Select * from CountryStatus
Inner Join PRODUCTS
ON
CountryStatus.ProductID=PRODUCTS.ProductID
Result:
QUARY:
5
SQL JOINS
II.OUTER JOIN
Outer Joins are three types
a. Right Outer Join
b. Left Outer Join
c. Full Outer join
6
SQL JOINS
a. Right Outer Join
Right outer join returns all records/rows from right table and from left table
returns only matched records.
Syntax:
Select * from Table 1
Right Outer Join Table 2
ON
Table 1.Column 1=Table 2.Column 1
7
SQL JOINS
QUARY:
Select * from CountryStatus
Right Outer Join PRODUCTS
ON
CountryStatus.ProductID=PRODUCTS.ProductID
RESULT:
8
SQL JOINS
b. Left Outer Join
Left outer join returns all records/rows from left table and from right
table returns only matched records.
Syntax:
Select * from Table 1
Left Outer Join Table 2
ON
Table 1.Column 1=Table 2.Column
1
9
SQL JOINS
RESULT:
QUARY:
Select * from CountryStatus
Left Outer Join PRODUCTS
ON
CountryStatus.ProductID=PRODUCTS.ProductID
10
SQL JOINS
c. Full Outer Join
Full outer join combines left outer join and right outer join. This join
returns all records/rows from both the tables.
Syntax:
Select * from Table 1
Full Outer Join Table 2
ON
Table 1.Column 1=Table 2.Column
1
11
SQL JOINS
QUARY:
Select * from CountryStatus
Full Outer Join PRODUCTS
ON
CountryStatus.ProductID=PRODUCTS.ProductID
RESULT:
12
SQL JOINS
III. Cross Join
This join returns records/rows that are multiplication of record number
from both the tables means each row on left table will related to each row
of right table.
Syntax:
Select * from Table 1
Cross Join Table 2
13
SQL JOINS
QUARY:
Select * from CountryStatus
Cross Join PRODUCTS
RESULT:
14

More Related Content

What's hot

Inner join and outer join
Inner join and outer joinInner join and outer join
Inner join and outer join
Nargis Ehsan
 

What's hot (20)

Inner join and outer join
Inner join and outer joinInner join and outer join
Inner join and outer join
 
Using the set operators
Using the set operatorsUsing the set operators
Using the set operators
 
introdution to SQL and SQL functions
introdution to SQL and SQL functionsintrodution to SQL and SQL functions
introdution to SQL and SQL functions
 
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
 
Mysql joins
Mysql joinsMysql joins
Mysql joins
 
MYSQL Aggregate Functions
MYSQL Aggregate FunctionsMYSQL Aggregate Functions
MYSQL Aggregate Functions
 
MYSQL join
MYSQL joinMYSQL join
MYSQL join
 
Presentation slides of Sequence Query Language (SQL)
Presentation slides of Sequence Query Language (SQL)Presentation slides of Sequence Query Language (SQL)
Presentation slides of Sequence Query Language (SQL)
 
SQL Basics
SQL BasicsSQL Basics
SQL Basics
 
SQL Commands
SQL Commands SQL Commands
SQL Commands
 
Sql queries presentation
Sql queries presentationSql queries presentation
Sql queries presentation
 
Sql commands
Sql commandsSql commands
Sql commands
 
SQL practice questions set - 2
SQL practice questions set - 2SQL practice questions set - 2
SQL practice questions set - 2
 
SQL subquery
SQL subquerySQL subquery
SQL subquery
 
Database Management - Lecture 2 - SQL select, insert, update and delete
Database Management - Lecture 2 - SQL select, insert, update and deleteDatabase Management - Lecture 2 - SQL select, insert, update and delete
Database Management - Lecture 2 - SQL select, insert, update and delete
 
Group By, Having Clause and Order By clause
Group By, Having Clause and Order By clause Group By, Having Clause and Order By clause
Group By, Having Clause and Order By clause
 
Sql Constraints
Sql ConstraintsSql Constraints
Sql Constraints
 
Basic sql Commands
Basic sql CommandsBasic sql Commands
Basic sql Commands
 
MS Sql Server: Joining Databases
MS Sql Server: Joining DatabasesMS Sql Server: Joining Databases
MS Sql Server: Joining Databases
 
SQL Joins With Examples | Edureka
SQL Joins With Examples | EdurekaSQL Joins With Examples | Edureka
SQL Joins With Examples | Edureka
 

Viewers also liked

Viewers also liked (20)

joins in database
 joins in database joins in database
joins in database
 
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
 
Semi join
Semi joinSemi join
Semi join
 
Sql join
Sql  joinSql  join
Sql join
 
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
 
SQL JOINS- Reena P V
SQL JOINS- Reena P VSQL JOINS- Reena P V
SQL JOINS- Reena P V
 
SQL JOIN Explained Visually
SQL JOIN Explained VisuallySQL JOIN Explained Visually
SQL JOIN Explained Visually
 
Join
JoinJoin
Join
 
Subqueries
SubqueriesSubqueries
Subqueries
 
Sql queires
Sql queiresSql queires
Sql queires
 
SQL : introduction
SQL : introductionSQL : introduction
SQL : introduction
 
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
 
Sql ppt
Sql pptSql ppt
Sql ppt
 
SQL Joinning.Database
SQL Joinning.DatabaseSQL Joinning.Database
SQL Joinning.Database
 
Tipos de datos oracle
Tipos de datos   oracleTipos de datos   oracle
Tipos de datos oracle
 
Why is Change So Hard in Oracle® Applications?
Why is Change So Hard in Oracle® Applications?Why is Change So Hard in Oracle® Applications?
Why is Change So Hard in Oracle® Applications?
 
Oracle Date Functions
Oracle Date FunctionsOracle Date Functions
Oracle Date Functions
 
Les06 (using subqueries to solve queries)
Les06 (using subqueries to solve queries)Les06 (using subqueries to solve queries)
Les06 (using subqueries to solve queries)
 
Joins
JoinsJoins
Joins
 

Similar to Sql joins

Similar to Sql joins (18)

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
 
Joins
JoinsJoins
Joins
 
21 types of sql joins
21 types of sql joins21 types of sql joins
21 types of sql joins
 
Query processing and data analysis
Query processing and data analysisQuery processing and data analysis
Query processing and data analysis
 
MS SQLSERVER:Joining Databases
MS SQLSERVER:Joining DatabasesMS SQLSERVER:Joining Databases
MS SQLSERVER:Joining Databases
 
MS SQL SERVER: Joining Databases
MS SQL SERVER: Joining DatabasesMS SQL SERVER: Joining Databases
MS SQL SERVER: Joining Databases
 
Joins in SQL
Joins in SQLJoins in SQL
Joins in SQL
 
SQL JOIN.pptx
SQL JOIN.pptxSQL JOIN.pptx
SQL JOIN.pptx
 
Unions and joins in mysql
Unions and joins in mysqlUnions and joins in mysql
Unions and joins in mysql
 
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
 
V19 join method-c
V19 join method-cV19 join method-c
V19 join method-c
 
database .pptx
database .pptxdatabase .pptx
database .pptx
 
MySQL JOINS
MySQL JOINSMySQL JOINS
MySQL JOINS
 
types of SQL Joins
 types of SQL Joins types of SQL Joins
types of SQL Joins
 
Internal tables
Internal tables Internal tables
Internal tables
 
Advance database system(part 8)
Advance database system(part 8)Advance database system(part 8)
Advance database system(part 8)
 
Joining
JoiningJoining
Joining
 
Joins and Views.pptx
Joins and Views.pptxJoins and Views.pptx
Joins and Views.pptx
 

Recently uploaded

How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
Alluxio, Inc.
 

Recently uploaded (20)

How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
De mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FMEDe mooiste recreatieve routes ontdekken met RouteYou en FME
De mooiste recreatieve routes ontdekken met RouteYou en FME
 
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
AI/ML Infra Meetup | Improve Speed and GPU Utilization for Model Training & S...
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
AI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning FrameworkAI/ML Infra Meetup | Perspective on Deep Learning Framework
AI/ML Infra Meetup | Perspective on Deep Learning Framework
 
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAGAI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
AI/ML Infra Meetup | Reducing Prefill for LLM Serving in RAG
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Studiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting softwareStudiovity film pre-production and screenwriting software
Studiovity film pre-production and screenwriting software
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 

Sql joins

  • 3. 3 SQL JOINS I.INNER JOIN Inner join returns only those records that match in both the tables. Syntax: Select * from table 1 INNER JOIN table 2 ON Table 1.Column 1=table 2.Column 1
  • 4. 4 SQL JOINS Select * from CountryStatus Inner Join PRODUCTS ON CountryStatus.ProductID=PRODUCTS.ProductID Result: QUARY:
  • 5. 5 SQL JOINS II.OUTER JOIN Outer Joins are three types a. Right Outer Join b. Left Outer Join c. Full Outer join
  • 6. 6 SQL JOINS a. Right Outer Join Right outer join returns all records/rows from right table and from left table returns only matched records. Syntax: Select * from Table 1 Right Outer Join Table 2 ON Table 1.Column 1=Table 2.Column 1
  • 7. 7 SQL JOINS QUARY: Select * from CountryStatus Right Outer Join PRODUCTS ON CountryStatus.ProductID=PRODUCTS.ProductID RESULT:
  • 8. 8 SQL JOINS b. Left Outer Join Left outer join returns all records/rows from left table and from right table returns only matched records. Syntax: Select * from Table 1 Left Outer Join Table 2 ON Table 1.Column 1=Table 2.Column 1
  • 9. 9 SQL JOINS RESULT: QUARY: Select * from CountryStatus Left Outer Join PRODUCTS ON CountryStatus.ProductID=PRODUCTS.ProductID
  • 10. 10 SQL JOINS c. Full Outer Join Full outer join combines left outer join and right outer join. This join returns all records/rows from both the tables. Syntax: Select * from Table 1 Full Outer Join Table 2 ON Table 1.Column 1=Table 2.Column 1
  • 11. 11 SQL JOINS QUARY: Select * from CountryStatus Full Outer Join PRODUCTS ON CountryStatus.ProductID=PRODUCTS.ProductID RESULT:
  • 12. 12 SQL JOINS III. Cross Join This join returns records/rows that are multiplication of record number from both the tables means each row on left table will related to each row of right table. Syntax: Select * from Table 1 Cross Join Table 2
  • 13. 13 SQL JOINS QUARY: Select * from CountryStatus Cross Join PRODUCTS RESULT:
  • 14. 14