As the name signifies, in SELF JOIN a table is joined to itself. That is, each row of the table is joined with itself and all other rows depending on some conditions. In other words we can say that it is a join between two copies of the same table.
|SELECT attribute_name(s) FROM table1 AS T1, table1 AS Tn WHERE condition;|
T1 and T2 are different table aliases for the same table.
Now we consider a table ‘employee’ …
Let’s perform self join operations…
In this join, it selects only those rows(records) which will be available in both tables. Lets understand through below example
|SELECT attribute_names FROM table1 INNER JOIN table2 WHERE condition;|
Let’s consider two tables – ‘employee’ & ‘empinfo’.
Let’s implement INNER JOIN operations…