You are here
Home > Posts tagged "self join"


SQL JOIN Self Join: Self join is used to join table with itself. Syntax: select column_name(s) from table1 A1,table2 A2 where condition; Here, A1 and A2 are different alias name for the same table. Database Table: Customers Cust_id Name Age City 1 Prince 22 Anand 2 Komal 44 Pune 3 Khusi 30 Delhi 4 Anil 45 Mumbai 5 Abhi 27 Ahmedabad 6 Juhi 35 Baroda   Here, Cust_id is primary key. Example-1: select x.Name as Name1, x.Age as Age1, x.City as City1, y.Name