Syntax of SELF JOIN in SQL-
SELECTย <column_name(s)>
FROMย <table1> t1, <table1>t2
WHERE<condition>;
Example of SELF JOIN in SQL-
SELECTย A.CustomerNameย ASย Customer1, B.CustomerNameย ASย Customer2,ย A.City
FROMย Customers A, Customers B
WHEREย A.CustomerID <> B.CustomerID
ANDย A.City = B. City;
โ SELF JOIN query customers that are from the same city.
Saraswat World Changed status to publish June 8, 2023
Leave a Reply