Back to course home
0% completed
SELF JOIN
A SELF JOIN in SQL is a join where a table is joined with itself. This means that you treat the table as two separate entities within the same query, allowing you to compare or combine rows from the same table based on a specified condition.
Syntax
SELECT t1.column_name, t2.column_name FROM table_name t1 JOIN table_name t2 ON t1.common_column = t2.common_column;
Example
Consider a table named employees
with columns such as employee_id
and manager_id
, where manager_id
refers to the employee_id
of the employee's manager.
Now, let's perform a SELF JOIN to retrie
.....
.....
.....
Like the course? Get enrolled and start learning!
Table of Contents
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible
Contents are not accessible