How do databases retrieve related data stored across multiple tables? The answer is joins in dbms. A join in database management system links rows from two or more tables based on a related column, enabling meaningful data retrieval from normalised database structures. This guide covers every type of join in dbms – inner, outer, natural, equi, theta, self, cross – with SQL examples, join strategies in dbms, and the join dependency in dbms concept from database theory.
What is Join in DBMS? – Definition
To define join in dbms: a join operator in dbms is an SQL operation that combines rows from two or more tables based on a matching condition. Without joins in dbms, retrieving related data stored in separate normalised tables would require multiple queries and manual result assembly.
Property |
Description |
Join in database management system |
SQL operator combining rows from multiple tables on a related column |
Join condition (predicate) |
The ON clause that specifies which columns must match between tables |
Join operator in dbms |
The keyword (INNER JOIN, LEFT JOIN, etc.) that determines which rows are included |
Result set |
Combined columns from all joined tables, filtered by the join condition |
Why needed |
Normalised databases split related data across tables – joins reassemble it on demand |
Key Concept: A join in database management system is the direct consequence of normalisation. When data is distributed across related tables to eliminate redundancy, the join operator in dbms is the mechanism to reassemble that data efficiently at query time. |

POSTGRADUATE PROGRAM IN
Multi Cloud Architecture & DevOps
Master cloud architecture, DevOps practices, and automation to build scalable, resilient systems.
Types of Join in DBMS – Quick Reference
All joins and its types in dbms at a glance:
Join Type |
Rows Returned |
NULLs? |
Keyword |
Matched rows from both tables only |
No |
INNER JOIN |
|
All left rows + matched right |
Right side |
LEFT JOIN |
|
Right Outer Join |
All right rows + matched left |
Left side |
RIGHT JOIN |
Full Outer Join |
All rows from both tables |
Both sides |
FULL OUTER JOIN |
Cross Join |
Every row × every row (Cartesian) |
No |
CROSS JOIN |
Self Join |
Table joined with itself |
Depends |
Aliased table |
Natural Join |
Auto-matched on common-name columns |
If no match |
NATURAL JOIN |
Equi Join |
Equality condition only (=) |
No (inner behaviour) |
JOIN … ON a.id = b.id |
Theta Join |
Any comparison operator (>, <, !=) |
Depends |
JOIN … ON condition |
Inner Join in DBMS
The inner join in dbms returns only rows with matching values in both tables. Unmatched rows from either table are excluded. It is the most widely used sql join in dbms and the default when no outer qualifier is specified.
Students Table:
|
|
|
|
|
|
|
|
|
|
|
|
Courses Table:
|
|
|
|
|
|
|
|
|
|
|
|
|
Output:
|
|
|
|
|
|
Divyansh (student_id=3) has no matching course record – excluded by the inner join in dbms. course_id=103 maps to student_id=4 which doesn’t exist in Students – also excluded. Only rows with matches in both tables appear.
Also Read: Relational Algebra in DBMS
Theta Join in DBMS
Theta join is a generalisation of the join operator in dbms that allows any comparison operator in the condition – >, <, >=, <=, or !=. This makes it more flexible than the equi join for range-based or inequality-based matching. This is one of the key join in dbms with example patterns used for salary bands, price ranges, and date intervals.
Employees Table:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Departments Table:
|
|
|
|
|
|
|
|
|
|
|
|
|
Output:
|
|
|
|
|
|
|
|
|
|
|
|
An employee may match multiple departments because the theta condition (salary >=) is satisfied against more than one department’s min_salary. Krish (60,000) qualifies for both IT (min 55,000) and HR (min 45,000).

82.9%
of professionals don't believe their degree can help them get ahead at work.
Equi Join in DBMS
Equi join in dbms is a theta join where the condition exclusively uses equality (=). It is functionally the same as an inner join on matching key columns. The equi join in dbms is the most common join condition pattern in relational database design – virtually every foreign key-to-primary key join is an equi join.
Authors Table:
|
|
|
|
|
|
|
|
Books Table:
|
|
|
|
|
|
|
|
|
|
|
|
|
Output:
|
|
|
|
|
|
|
|
Natural Join in DBMS
Natural join in dbms automatically joins tables on all columns that share the same name and compatible data type – no ON clause is needed. The natural join in dbms eliminates duplicate common columns from the output, showing them only once.
Employees Table:
|
|
|
|
|
|
|
|
|
|
|
|
Departments Table:
|
|
|
|
|
|
|
|
|
Output:
|
|
|
|
|
|
|
|
Key Concept: Use natural join in dbms with caution. If both tables share multiple column names (name, id, date), the natural join matches on ALL of them simultaneously – potentially producing no results or wrong results. Explicit ON conditions are always safer for production SQL. |
Outer Join in DBMS
The outer join in dbms includes rows that do not have a matching record in the joined table, replacing missing values with NULL. This distinguishes the outer join in dbms from the inner join – no row from the preserved side is ever excluded.
Left Outer Join
Customers Table:
|
|
|
|
|
|
|
|
Orders Table:
|
|
|
|
|
|
|
|
|
|
|
|
|
Output:
|
|
|
|
|
|
|
|
Anupriya (customer_id=3) has no order – the outer join in dbms preserves her row with NULL for product_name.
Right Outer Join
Products Table:
|
|
|
|
|
|
|
|
Suppliers Table:
|
|
|
|
|
|
|
|
|
|
|
|
|
Output:
|
|
|
|
|
|
|
|
Full Outer Join
|
Full outer join is the most inclusive type of outer join in dbms – every row from both tables appears, with NULLs wherever no match exists on either side.
Self Join in DBMS
A self join in dbms joins a table with itself by aliasing it twice – useful for hierarchical or self-referencing relationships within a single table. The self join in dbms requires two different aliases so the query engine treats the same table as two logical tables.
Employees Table (with manager_id):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Output:
|
|
|
|
|
|
|
|
|
|
Self Join Use Case |
Description |
Employee-Manager hierarchy |
Find who each employee reports to via a self-referencing manager_id |
Product category tree |
Navigate parent-child category relationships in a single Category table |
Bill of Materials |
Identify components that are also sub-assemblies of other components |
Social network connections |
Find mutual connections within a single Users table |
Cross Join in DBMS
A cross join produces the Cartesian product of two tables – every row from Table A combined with every row from Table B. If Table A has m rows and Table B has n rows, the result has m × n rows. No join condition is specified.
Colours (3 rows) × Sizes (2 rows) = 6 rows:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Key Concept: Cross joins generate very large result sets quickly – 1,000 rows × 1,000 rows = 1,000,000 rows. Use intentionally for combination matrices (e.g., product configurations). Accidental cross joins on large tables are a common performance disaster. |
Join Dependency in DBMS
Join dependency in dbms is a normalisation concept from 5th Normal Form (5NF/PJNF). A join dependency in dbms exists when a table can be losslessly decomposed into multiple projections and exactly reconstructed via natural joins without producing spurious (incorrect) or missing rows.
Aspect |
Description |
Definition |
A table satisfies a join dependency if it can be decomposed into n projections and reconstructed via joins without data loss |
Related Normal Form |
Fifth Normal Form (5NF) – also called Project-Join Normal Form (PJNF) |
Goal |
Eliminate all join dependencies not implied by candidate keys |
When it occurs |
Three-way (or higher) relationships that cannot be safely split into two-way tables |
Violation consequence |
Decomposed tables, when rejoined, produce missing rows or incorrect spurious tuples |
Classic example |
Supplier-Part-Project: three-way relationship that cannot be losslessly split into three two-way tables |
Join dependency in dbms affects schema design decisions. Violating a join dependency means the joins in dbms on decomposed tables will either miss valid combinations or produce incorrect extra rows. Designing to 5NF ensures all join dependencies are properly handled – making every sql join in dbms produce correct, complete results.
Join Strategies in DBMS
Join strategies in dbms are the internal algorithms a query engine uses to physically execute a join. The query optimiser selects from these join strategies in dbms based on table sizes, available indexes, memory, and the join condition. Understanding them helps diagnose slow queries.
Strategy |
Mechanism |
Best For |
Nested Loop Join |
For each outer row, scan all inner rows for matches – O(m×n) |
Small tables or indexed inner table (O(m×log n)) |
Hash Join |
Build hash table from smaller table; probe with larger – O(m+n) |
Large equality joins without usable index |
Sort-Merge Join |
Sort both on join key; merge in one pass – O(m log m + n log n) |
Pre-sorted data; range joins; large tables |
Index Nested Loop |
Nested loop using index on inner table |
Selective equality conditions with existing index |
Grace Hash Join |
Partitioned hash for joins exceeding memory |
Very large tables beyond available RAM |
|
SQL Join Operators in DBMS – Comparison
Reference table for all sql join operators in dbms – behaviour, NULL handling, and use case:
SQL Join Operator |
Rows Returned |
NULLs |
Typical Use Case |
INNER JOIN |
Matched rows only |
No |
Fetch records existing in both tables |
LEFT JOIN |
All left + matched right |
Yes (right) |
Preserve all left-table records; find unmatched |
RIGHT JOIN |
All right + matched left |
Yes (left) |
Preserve all right-table records; find unmatched |
FULL OUTER JOIN |
All rows, both tables |
Yes (both) |
Complete picture – nothing excluded |
CROSS JOIN |
All combinations (m×n) |
No |
Generate all possible row combinations |
NATURAL JOIN |
Common-column matched |
Depends |
Quick join on shared names (use cautiously) |
SELF JOIN |
Same table with aliases |
Depends |
Hierarchical/self-referencing data |
Most sql join operators in dbms work identically across MySQL, PostgreSQL, Oracle, and SQL Server. Notable exception: FULL OUTER JOIN is not supported natively in MySQL – simulate with UNION of LEFT and RIGHT JOIN. NATURAL JOIN behaviour varies by database – explicit ON conditions are always recommended for production.
Conclusion
Joins in dbms are the fundamental mechanism for retrieving related data from normalised relational databases. Each type of join in dbms serves a specific purpose: the inner join in dbms for matched records only, the outer join in dbms for preserving unmatched rows, the natural join in dbms for automatic column matching, the equi join in dbms for equality conditions, and the self join in dbms for self-referencing hierarchical data.
Understanding join dependency in dbms ensures schemas are designed correctly at the normalisation level, while knowledge of join strategies in dbms helps optimise query performance. Mastering all sql join operators in dbms – and knowing when to explain joins in dbms to stakeholders – is essential for database professionals and backend developers.
To build complete expertise in database management and full-stack development, explore the Full Stack Development with Specialisation for Web and Mobile powered by Hero Vired.
People Also Ask
What is join in DBMS?
To define join in dbms: a join is an SQL operation combining rows from two or more tables based on a related column. The join operator in dbms enables retrieval of meaningful data from normalised databases where related information is stored across separate tables. Without joins in dbms, multi-table data retrieval would require multiple queries and manual assembly.
What are the types of join in DBMS?
The types of join in dbms are: Inner Join (matched rows only), Left/Right/Full Outer Join (includes unmatched rows with NULLs), Cross Join (Cartesian product), Self Join (table joined with itself), Natural Join (auto-matched on common column names), Equi Join (equality-operator condition), and Theta Join (any comparison operator). Together these joins and its types in dbms cover every multi-table data retrieval scenario.
What is the difference between inner join and outer join in DBMS?
The inner join in dbms returns only rows with matches in both tables – unmatched rows are excluded. The outer join in dbms includes unmatched rows, filling missing values with NULL. Left outer join preserves all rows from the left table; right outer join from the right; full outer join from both. Choose inner join for intersecting records; outer join when unmatched records are also needed.
What is a self join in DBMS?
A self join in dbms joins a table with itself using two aliases. It is the standard approach for navigating hierarchical or self-referencing relationships within a single table – most commonly an employee-manager hierarchy where manager_id references emp_id in the same Employees table. The self join in dbms requires the table to be referenced twice with different alias names.
What are join strategies in DBMS?
Join strategies in dbms are the internal algorithms the query engine uses to execute joins: Nested Loop Join (each outer row scans inner table – O(m×n)), Hash Join (build hash table from smaller table – O(m+n)), Sort-Merge Join (sort both then merge – best for pre-sorted data), and Index Nested Loop (uses index on inner table). The query optimiser selects from these join strategies in dbms based on table statistics, indexes, and join condition – visible via EXPLAIN.
What is the primary purpose of a join operation in DBMS?
What is the difference between inner join and outer join?
When should I use a theta join instead of an inner join?
How does a natural join differ from an equi join?
Can I use multiple joins in a single query?
What is theta join in dbms?
Updated on April 16, 2026
