SQL Self Join
A SELF JOIN
is a join in which a table is joined with itself. It is useful for comparing rows within the same table.
Example: Using SELF JOIN
SELECT A.Name AS Fighter1, B.Name AS Fighter2
FROM FreedomFighters A
JOIN FreedomFighters B ON A.City = B.City AND A.FighterID <> B.FighterID;
Output:
Returns pairs of freedom fighters from the same city, excluding duplicates.