Oracle SELF JOIN
Published by : Obay Salah , December 2, 2024
Self Join is a specific type of Join. In Self Join, a table is joined with itself (Unary relationship). A self join simply specifies that each rows of a table is combined with itself and every other row of the table.
Syntax
SELECT a.column_name, b.column_name... FROM table1 a, table1 b WHERE a.common_filed = b.common_field;
Oracle SELF JOIN Example
Let's take a table "customers".
Join this table using SELF JOIN as follows:
SELECT a.name, b.age, a.SALARY FROM CUSTOMERS a, CUSTOMERS b WHERE a.SALARY < b.SALARY;
Output
Comments
no comment yet!