0% found this document useful (0 votes)
17 views11 pages

Join - 2nd Sem DBMS

The document explains the concept of JOINS in Database Management Systems (DBMS), which is a binary operation used to combine data from two or more tables based on primary and foreign keys. It categorizes JOINS into two main types: Inner Joins (including Equi Join and Natural Join) and Outer Joins (including Left, Right, and Full Outer Joins), detailing their functionalities and examples. The document emphasizes the importance of JOINS for performing operations on combined table data.

Uploaded by

Abbas Raja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views11 pages

Join - 2nd Sem DBMS

The document explains the concept of JOINS in Database Management Systems (DBMS), which is a binary operation used to combine data from two or more tables based on primary and foreign keys. It categorizes JOINS into two main types: Inner Joins (including Equi Join and Natural Join) and Outer Joins (including Left, Right, and Full Outer Joins), detailing their functionalities and examples. The document emphasizes the importance of JOINS for performing operations on combined table data.

Uploaded by

Abbas Raja
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Abbas Raja

[01]

JOINS IN
DBMS

Presented to :-
Mrs. Nidhi Mam
JOINS:-
JOINS:-Join in DBMS is a binary operation which allows you to combine
join product and selection in one single statement.
• Actually, in most cases, we need to combinedly work on these tables.
We have to use the combined result of these tables for more
operations.
• These operations can be achieved in DBMS using the ‘JOIN’
 The goal of creating a join condition is that it helps you to combine the
data from two or more DBMS tables.
 The tables in DBMS are associated using the primary key and foreign
keys.
 JOINS ARE DIVIDED INTO
TWO TYPES

1. Inner join :-
a. Equi join
B. Natural join
2. Outer join :-
a. Left outrt join
b. Right outer join
c. Full outer join
Types of join
 1.INNER JOIN :-Inner Join is used to return rows from both tables
which satisfy the given condition.
 It is the most widely used join operation and can be considered as a
default join-type
 Inner Join is a join that can be used to return
all the values that have matching values in
both the tables.
 Inner Join can be depicted using the side diagram.
Continue…
 The inner join can be further divided into the following types:-
A. Equi join :- Equi Join is an inner join that uses the equivalence
condition for fetching the values of two tables.
• Example: -Consider the two tables given below:
1.Student Table 2. Marks table
Continue…
 Consider the above two tables and the query is given below:
 SELECT * FROM student S INNER JOIN Marks M ON S.Roll_No = M.Roll_No;
 OUTPUT :-

B. NATURAL JOIN :-Natural Join joins two tables based on same attribute name
and datatypes.
 The resulting table will contain all the attributes of both the table but keep
only one copy of each common column.
Continue…
 Example: - Consider the two tables given above:-
 Given query :- SELECT * FROM Student NATURAL JOIN Marks;
 OUTPUT :-

2. OUTER JOIN :- An Outer Join doesn’t require each record in the two
join tables to have a matching record. In this type of join, the table
retains each record even if no other matching record exists.
Continue…
 Three types of Outer Joins are:-
A. LEFT-OUTER JOIN :-Left Outer Join returns all the rows from the table
on the left even if no matching rows have been found in the table on
the right.
 When no matching record is found
in the table on the right,
NULL is returned.
Continue…
 B. RIGHT-OUTER JOIN :-Right Outer Join returns all the columns
from the table on the right even if no matching rows have been found
in the table on the left. Where no matches have been found in the
table on the left, NULL is returned.
 RIGHT outer JOIN is the opposite of LEFT JOIN.
 Example :-
Continue…
 C. FULL-OUTER JOIN :- The Full-Outer join contains all the
values of both the tables whether they have matching values in them
or not.
 The Full-Outer Join can be depicted using the below diagram.
 The MySQL query for full-outer join can
be as follows:-
 Given query :-Select * from employee Full
Join department;

You might also like