SlideShare a Scribd company logo
Welcome
PRESENTED BY
SQL JOINS
TOPIC
CONTENT
INTRODUCTION
WHAT IS JOINNING???
A SQL join clause combines columns from
one or more tables in a relational database.
It creates a set that can be saved as a table
or used as it is.
A JOIN is a means for combining columns
from one (self-table) or more tables by using
values common to each.
DEFINITION
SQL JOINS
Inner Join
Outer Join
Cross Join
TYPES
INNER 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
SCENARIO
INNER JOINS
Result:
QUARY:
SELECT foods.item_name,foods.item_unit,
company.company_name,company.company_city
FROM foods
INNER JOIN company
ON foods.company_id =company.company_id;
ITEM_NAME ITEM_ COMPANY_NAME COMPANY_CITY
------------------------- ----- ------------------------- --------------
Chex Mix Pcs Akas Foods Delhi
Cheez-It Pcs Jack Hill Ltd London
BN Biscuit Pcs Jack Hill Ltd London
Mighty Munch Pcs Foodies. London
Pot Rice Pcs Jack Hill Ltd London
Jaffa Cakes Pcs Order All Boston
RIGHT 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
LEFT 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
SCENARIO
RIGHT JOINS
QUARY:
SELECT company.company_id,company.company_name,
company.company_city,foods.company_id,foods.item_name
FROM company
RIGHT JOIN foods
ON company.company_id = foods.company_id;
RESULT:
COMPANY_ID COMPANY_NAME COMPANY_CITY COMPANY_ID ITEM_NAME
---------- ------------------------- ------------------------- ---------- --------------
18 Order All Boston 18 Jaffa Cakes
15 Jack Hill Ltd London 15 Pot Rice
15 Jack Hill Ltd London 15 BN Biscuit
15 Jack Hill Ltd London 15 Cheez-It
16 Akas Foods Delhi 16 Chex Mix
17 Foodies. London 17 Mighty Munch
Salt n Shake
LEFT JOINS
RESULT:
QUARY:
SELECT company.company_id,company.company_name,
company.company_city,foods.company_id,foods.item_name
FROM company
LEFT JOIN foods
ON company.company_id = foods.company_id;
COMPANY_ID COMPANY_NAME COMPANY_CITY COMPANY_ID ITEM_NAME
---------- ------------------------- ------------------------- ---------- --------------
16 Akas Foods Delhi 16 Chex Mix
15 Jack Hill Ltd London 15 Cheez-It
15 Jack Hill Ltd London 15 BN Biscuit
17 Foodies. London 17 Mighty
15 Jack Hill Ltd London 15 Pot Rice
18 Order All Boston 18 Jaffa Cakes
19 sip-n-Bite. New York
FULL JOINSc. 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
CROSS 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
SCENARIO
FULL JOINSQUARY:
SELECT a.company_id AS "a.ComID",  
a.company_name AS "C_Name",  
b.company_id AS "b.ComID",   
b.item_name AS "I_Name"   FROM   company a   
FULL OUTER JOIN foods b   
ON a.company_id = b.company_id; 
RESULT:
a.ComID     C_Name          b.ComID    I_Name
---------- ------------------------- ---------- -------------
   16         Akas Foods             16         Chex Mix
  15         Jack Hill Ltd             15         Cheez-It
  15         Jack Hill Ltd             15         BN Biscuit
  17         Foodies.                  17          Mighty Munch
  15         Jack Hill Ltd             15          Pot Rice
  18         Order All                  18          Jaffa Cakes
                                                             Salt n Shake
  19   sip-n-Bite.
CROSS JOINS
QUARY:
SELECT foods.item_name,foods.item_unit,
company.company_name,company.company_city
FROM foods
CROSS JOIN company;
RESULT:
Any Query?????
Hey Buddy…..

More Related Content

PPTX
Group By, Having Clause and Order By clause
PPTX
Aggregate function
PPTX
SQL JOIN
PPT
Aggregate functions
PDF
Arrays in java
PPT
Introduction to-sql
PPTX
Date and time functions in mysql
Group By, Having Clause and Order By clause
Aggregate function
SQL JOIN
Aggregate functions
Arrays in java
Introduction to-sql
Date and time functions in mysql

What's hot (20)

PPTX
Stored procedure
PDF
Sql ch 5
ODT
Sql queries interview questions
PPTX
Dictionaries and Sets in Python
PDF
Introduction To Oracle Sql
PPT
Sql dml & tcl 2
PPT
SQL select statement and functions
PPSX
Oracle Advanced SQL
PPT
Lecture2 oracle ppt
DOC
Sql queries
PPTX
SQL Joins.pptx
PDF
Relational algebra in dbms
PPTX
Sql(structured query language)
PPT
ADO.NET
PPTX
Skillwise JCL
PPTX
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
PPT
Joins in SQL
PPT
MySQL lecture
Stored procedure
Sql ch 5
Sql queries interview questions
Dictionaries and Sets in Python
Introduction To Oracle Sql
Sql dml & tcl 2
SQL select statement and functions
Oracle Advanced SQL
Lecture2 oracle ppt
Sql queries
SQL Joins.pptx
Relational algebra in dbms
Sql(structured query language)
ADO.NET
Skillwise JCL
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Joins in SQL
MySQL lecture
Ad

Viewers also liked (20)

PPTX
PPT
Sql join
PPTX
SQL Join Basic
PPT
Sql joins
PPT
Types Of Join In Sql Server - Join With Example In Sql Server
PDF
SQL Joins and Query Optimization
PPTX
MS Sql Server: Joining Databases
PDF
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
PDF
MEDICAL IMAGE SEGMENTATION FOR DISEASE DETECTION USING DIGITAL FILTER
PDF
PARENTING STYLES AS A PREDICTORS OF ACADEMIC ACHIEVEMENT OF STUDENTS
DOCX
Bus 370 entire course
PDF
A STUDY OF DECISION TREE ENSEMBLES AND FEATURE SELECTION FOR STEEL PLATES FAU...
PDF
WEB PAGE RANKING BASED ON TEXT SUBSTANCE OF LINKED PAGES
PDF
A STUDY ON THE FRESH PROPERTIES OF SCC WITH FLY ASH
PDF
FERRITIC AS A POTENT MARKER OF BREST CANCER
PDF
AN IMPROVED TECHNIQUE FOR DOCUMENT CLUSTERING
PDF
DEVELOPMENT OF A MULTIAGENT BASED METHODOLOGY FOR COMPLEX SYSTEMS
PDF
Java interview questions tutorialspoint
Sql join
SQL Join Basic
Sql joins
Types Of Join In Sql Server - Join With Example In Sql Server
SQL Joins and Query Optimization
MS Sql Server: Joining Databases
Structured Query Language (SQL) - Lecture 5 - Introduction to Databases (1007...
MEDICAL IMAGE SEGMENTATION FOR DISEASE DETECTION USING DIGITAL FILTER
PARENTING STYLES AS A PREDICTORS OF ACADEMIC ACHIEVEMENT OF STUDENTS
Bus 370 entire course
A STUDY OF DECISION TREE ENSEMBLES AND FEATURE SELECTION FOR STEEL PLATES FAU...
WEB PAGE RANKING BASED ON TEXT SUBSTANCE OF LINKED PAGES
A STUDY ON THE FRESH PROPERTIES OF SCC WITH FLY ASH
FERRITIC AS A POTENT MARKER OF BREST CANCER
AN IMPROVED TECHNIQUE FOR DOCUMENT CLUSTERING
DEVELOPMENT OF A MULTIAGENT BASED METHODOLOGY FOR COMPLEX SYSTEMS
Java interview questions tutorialspoint
Ad

Similar to SQL Joinning.Database (12)

PPT
Database testing
PPT
Sql basic best-course-in-mumbai
PPTX
Oracle: Joins
PPTX
Oracle: Joins
PPT
SQL Presentation-1 (structured query language)
PPT
DBMS-SQL-Commands-BBA-4-Sem-1-PanjabUniversity.ppt
PPT
SQL Presentation-1 yehjebjj yeuu helo the worls.ppt
PPTX
SQL JOINS- Reena P V
PDF
IR SQLite Session #2
PDF
Database Architecture and Basic Concepts
PDF
Sql wksht-6
PPT
chapter 8 SQL.ppt
Database testing
Sql basic best-course-in-mumbai
Oracle: Joins
Oracle: Joins
SQL Presentation-1 (structured query language)
DBMS-SQL-Commands-BBA-4-Sem-1-PanjabUniversity.ppt
SQL Presentation-1 yehjebjj yeuu helo the worls.ppt
SQL JOINS- Reena P V
IR SQLite Session #2
Database Architecture and Basic Concepts
Sql wksht-6
chapter 8 SQL.ppt

More from Umme habiba (20)

DOCX
Compiler lab final report writing
PPTX
online bus ticket booking system
PPTX
online bus ticket booking system
PPTX
online bus ticket booking system
PPT
Accounting adjusting
DOCX
Economic.assignment
DOCX
Major economic problems of bangladesh
PPT
Overview of various types of operating system
DOCX
Os lab report(shell coding)
PPTX
Ecommerce(online Shopping)
DOCX
Different types of Addressing.cao
PPTX
2nd generation of computer
DOCX
Art_of_living assignment
PPTX
Art_of_living
DOCX
Informationsecurity
PPTX
WLAN of networking.ppt
PPTX
simpson's in numerical method
PPTX
Error detection in Data comunication
PPTX
microsoft word & powerpoint
PPTX
Upmovie review (1)
Compiler lab final report writing
online bus ticket booking system
online bus ticket booking system
online bus ticket booking system
Accounting adjusting
Economic.assignment
Major economic problems of bangladesh
Overview of various types of operating system
Os lab report(shell coding)
Ecommerce(online Shopping)
Different types of Addressing.cao
2nd generation of computer
Art_of_living assignment
Art_of_living
Informationsecurity
WLAN of networking.ppt
simpson's in numerical method
Error detection in Data comunication
microsoft word & powerpoint
Upmovie review (1)

Recently uploaded (20)

PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
Sustainable Sites - Green Building Construction
PPTX
OOP with Java - Java Introduction (Basics)
PDF
Well-logging-methods_new................
PPTX
UNIT 4 Total Quality Management .pptx
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPT
Project quality management in manufacturing
PPTX
web development for engineering and engineering
PPTX
Lecture Notes Electrical Wiring System Components
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
Welding lecture in detail for understanding
CYBER-CRIMES AND SECURITY A guide to understanding
Operating System & Kernel Study Guide-1 - converted.pdf
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Sustainable Sites - Green Building Construction
OOP with Java - Java Introduction (Basics)
Well-logging-methods_new................
UNIT 4 Total Quality Management .pptx
Automation-in-Manufacturing-Chapter-Introduction.pdf
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Project quality management in manufacturing
web development for engineering and engineering
Lecture Notes Electrical Wiring System Components
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
R24 SURVEYING LAB MANUAL for civil enggi
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Model Code of Practice - Construction Work - 21102022 .pdf
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Welding lecture in detail for understanding

SQL Joinning.Database