Account
Categories

SELF JOIN: Compare Data Within Same Table


SELF JOIN means joining a table to itself.
It is an operator that joins its table.
It joins the same table twice, compares the data within the same table, and performs the join.
In this process, the columns act as operands, and after joining the data, it returns the results accordingly.

Syntax:

SELECT A.columns, B.columns
FROM table_name A, table_name B
WHERE A.common_column = B.common_column;