Skip
Arish's avatar

182. Practice - SELF JOIN 2


Exercise: Students Same Age

Find pairs of students with same age.

Solution

sql
1SELECT a.name, b.name, a.age
2FROM students a
3JOIN students b ON a.age = b.age AND a.id < b.id;