Difference Between Inner and Outer Joins in DBMS SQL

DBMS SQL | Inner Vs Outer Joins: In this tutorial, we will learn about the inner join and outer join and the differences between inner join and outer join. By Anushree Goswami Last updated : May 28, 2023

Prerequisite: DBMS SQL Joins (with Examples)

What is Inner Join?

Inner Join is that type of join which it returns the record that has matching values in both tables. There are mainly three types of join which we have studied about in Extended Operators in Relation Algebra section, i.e., Condition Join, Equi Join, and Natural Join. It is denoted by the symbol .

What is Outer Join?

There are three types of Outer Join,

  1. Left Outer Join is that type of Join which returns all records from the left table and the matched record from the right table. It is denoted by the symbol .
  2. Right Outer Join is that type of Join which returns all records from the right table and the matched record from the left table. It is denoted by the symbol .
  3. Full Outer Join is that type of Join which returns all records when there is a match in either the left or right table. It is denoted by the symbol .

Difference Between Inner Join and Outer Join

S.No. Inner Join Outer Join
1 It returns the record that has a matching value in both tables. It returns the record that has matching value as well as some dissimilar data from the tables.
2 Types of Inner Join - Condition Join, Equi Join and Natural Join. Types of Outer Join - Left Outer Join, Right Outer Join, and Full Outer Join.
3 There must be at least one matching data between the two tables. There may not be any matching data between the two tables.
4 It never produces NULL values. It can produce NULL values.
5 It will not produce any tuple if no matching data is found between the two tables. It will always produce at least one tuple even if no matching data is found in between the two tables.



Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.