SELF JOIN Examples - SQL Query
A Self join is used in condition where user needs to create a result set that joins records in a table with other records in the same table.
Consider the following table 'Students'.
Write a query to find out which students are from the same location as Student 'Jaya'.
FROM Students S1, Students S2
WHERE S1.Stud_location = S2.Stud_location
In the above query S1 and S2 are used as Aliases. So this query will find the Students from same location.