Pairs of students sharing a course

SQLHard15 min

Your task

Find every pair of students enrolled in the same course. Return a, b and title, with each pair listed once and a before b alphabetically. Order by title then a then b.

Tables

student
idINTEGERnameTEXTyearINTEGER
1Tam1
2Uli2
3Vic2
4Wren3
course
idINTEGERtitleTEXTcreditsINTEGER
1Databases4
2Networks3
3Compilers4
4Ethics2
enrolment
student_idINTEGERcourse_idINTEGERgradeINTEGER
1188
1272
2191
2364
3191
3255
More rows not shown