0% found this document useful (0 votes)
54 views8 pages

Joins

The document discusses different types of joins in DBMS including inner joins, outer joins, self joins, and cross joins. Inner joins include theta and natural joins. Outer joins include left, right, and full outer joins. A self join joins a table to itself. A cross join returns the cartesian product between two tables.

Uploaded by

manasailla666
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)
54 views8 pages

Joins

The document discusses different types of joins in DBMS including inner joins, outer joins, self joins, and cross joins. Inner joins include theta and natural joins. Outer joins include left, right, and full outer joins. A self join joins a table to itself. A cross join returns the cartesian product between two tables.

Uploaded by

manasailla666
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/ 8

joins

What is Join in DBMS?

• Join in DBMS is a binary operation which allows you to


combine join product and selection in one single statement.
The goal of creating a join condition is that it helps you to
combine the data from two or more DBMS tables

• Types of Join
• Inner Joins: Theta, Natural
• Outer Join: Left, Right, Full
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 further divided into three subtypes:
• Theta join
• Natural join
• THETA JOIN allows you to merge two tables based on the
condition represented by theta. Theta joins work for all
comparison operators. It is denoted by symbol θ.

• A ⋈θ B
• Natural Join, there should be at least one common attribute
between two relations.
• It performs selection forming equality on those attributes which
appear in both relations and eliminates the duplicate attributes.
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.
• Three types of Outer Joins are:
• Left Outer Join
• Right Outer Join
• Full Outer Join
SELF JOIN
• A self join is a join in which the table is joined with itself,
specialy when the table has a foreign key and it references to
its own primary key
• SELECT
• employee.Id,
• employee.FullName,
• employee.ManagerId,
• manager.FullName as ManagerName
• FROM Employees employee
• JOIN Employees manager
• ON employee.ManagerId = manager.Id
Id FullName Salary ManagerId
1 John Smith 10000 3
2 Jane Anderson 12000 3
3 Tom Lanon 15000 4
4 Anne Connor 20000
5 Jeremy York 9000 1
Cross join
• Cross join (cartesian product)
• Select * from table_a cross join table_b;

You might also like