DBMS Joins: THETA, Inner, Outer, Equi Types of Join
โก Smart Summary
Join in DBMS is a binary operation that combines rows from two or more tables using their primary and foreign keys. Joins split into inner joins, which return only matching rows, and outer joins, which keep unmatched rows and fill gaps with null.

What is a Join in DBMS?
Join in DBMS is a binary operation that allows you to combine a join product and a selection in a single statement. The goal of creating a join condition is to combine the data from two or more tables. The tables are associated using their primary keys and foreign keys.
Types of Join
There are mainly two types of joins in DBMS:
- Inner Joins: Theta, Natural, EQUI
- Outer Joins: Left, Right, Full
The table below previews all the join types before each is explained with an example.
| Join | Returns | Unmatched rows |
|---|---|---|
| Inner (Theta / EQUI / Natural) | Rows matching the condition in both tables | Dropped |
| Left Outer | All left rows plus matches | Kept from left, null on right |
| Right Outer | All right rows plus matches | Kept from right, null on left |
| Full Outer | All rows from both tables | Kept from both, null where missing |
Inner Join
Inner Join is used to return rows from both tables that satisfy the given condition. It is the most widely used join operation and can be considered the default join type.
An inner join, or equijoin, is a comparator-based join that uses equality comparisons in the join predicate. However, if you use other comparison operators like “>”, it cannot be called an equijoin. Inner join is further divided into three subtypes:
- Theta join
- Natural join
- EQUI join
Theta 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 the symbol ฮธ. The general case of a JOIN operation is called a theta join.
Syntax:
A โฮธ B
A theta join can use any conditions in the selection criteria.
Consider the following tables.
| Table A | Table B | |||
|---|---|---|---|---|
| column 1 | column 2 | column 1 | column 2 | |
| 1 | 1 | 1 | 1 | |
| 1 | 2 | 1 | 3 | |
For example:
A โ A.column 2 > B.column 2 (B)
| A โ A.column 2 > B.column 2 (B) | |
|---|---|
| column 1 | column 2 |
| 1 | 2 |
EQUI Join
EQUI Join is done when a theta join uses only the equivalence condition. EQUI join is the most difficult operation to implement efficiently in an RDBMS, and it is one reason why an RDBMS can have performance problems.
For example:
A โ A.column 2 = B.column 2 (B)
| A โ A.column 2 = B.column 2 (B) | |
|---|---|
| column 1 | column 2 |
| 1 | 1 |
Natural Join (โ)
Natural Join does not use any comparison operator. In this type of join, the attributes should have the same name and domain. In a natural join, there should be at least one common attribute between the two relations.
It performs a selection forming equality on the attributes that appear in both relations and eliminates the duplicate attributes.
Example: consider the following two tables.
| C | |
|---|---|
| Num | Square |
| 2 | 4 |
| 3 | 9 |
| D | |
|---|---|
| Num | Cube |
| 2 | 8 |
| 3 | 18 |
C โ D
| C โ D | ||
|---|---|---|
| Num | Square | Cube |
| 2 | 4 | 8 |
| 3 | 9 | 18 |
Outer Join
An Outer Join does not require each record in the two joined tables to have a matching record. In this type of join, the table retains each record even if no other matching record exists. The three types of outer join are:
- Left Outer Join
- Right Outer Join
- Full Outer Join
Left Outer Join (A โ B)
Left Outer Join returns all the rows from the table on the left, even if no matching rows are found in the table on the right. When no matching record is found on the right, null is returned.
Consider the following two tables.
| A | |
|---|---|
| Num | Square |
| 2 | 4 |
| 3 | 9 |
| 4 | 16 |
| B | |
|---|---|
| Num | Cube |
| 2 | 8 |
| 3 | 18 |
| 5 | 75 |
AB
| A โ B | ||
|---|---|---|
| Num | Square | Cube |
| 2 | 4 | 8 |
| 3 | 9 | 18 |
| 4 | 16 | – |
Right Outer Join (A โ B)
Right Outer Join returns all the columns from the table on the right, even if no matching rows are found in the table on the left. Where no matches are found on the left, null is returned. A right outer join is the opposite of a left join.
AB
| A โ B | ||
|---|---|---|
| Num | Cube | Square |
| 2 | 8 | 4 |
| 3 | 18 | 9 |
| 5 | 75 | – |
Full Outer Join (A โ B)
In a Full Outer Join, all tuples from both relations are included in the result, irrespective of the matching condition.
Example:
AB
| A โ B | ||
|---|---|---|
| Num | Square | Cube |
| 2 | 4 | 8 |
| 3 | 9 | 18 |
| 4 | 16 | – |
| 5 | – | 75 |


