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;
Find pairs of students with same age.
1SELECT a.name, b.name, a.age
2FROM students a
3JOIN students b ON a.age = b.age AND a.id < b.id;