0 votes
in Sql by
What is a Self-Join?

1 Answer

0 votes
by
A self JOIN is a case of regular join where a table is joined to itself based on some relation between its own column(s). Self-join uses the INNER JOIN or LEFT JOIN clause and a table alias is used to assign different names to the table within the query.

SELECT A.emp_id AS "Emp_ID",A.emp_name AS "Employee",

B.emp_id AS "Sup_ID",B.emp_name AS "Supervisor"

FROM employee A, employee B

WHERE A.emp_sup = B.emp_id;

Related questions

0 votes
asked Dec 13, 2020 in Sql by SakshiSharma
+2 votes
0 votes
0 votes
0 votes
asked Nov 8, 2021 in Sql by rajeshsharma
...