Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT students.name,class,s.name,sg.location,sg.hourOfTraining,sg.dayOfWeek,c.name FROM students
- JOIN student_sport ss on students.id = ss.student_id
- JOIN sportGroups sG on ss.sportGroup_id = sG.id
- JOIN sports s on sG.sport_id = s.id
- JOIN coaches c on sG.coach_id = c.id
- WHERE s.name = 'Volleyball';
- SELECT coaches.name,sG.id,s.name,s2.class,sg.dayOfWeek FROM coaches
- JOIN sportGroups sG on coaches.id = sG.coach_id
- JOIN sports s on sG.sport_id = s.id
- JOIN student_sport ss on sG.id = ss.sportGroup_id
- JOIN students s2 on ss.student_id = s2.id
- WHERE s2.class = '11'
- ORDER BY
- case dayOfWeek
- when 'Monday' then 1
- when 'Tuesday' then 2
- when 'Wednesday' then 3
- when 'Thursday' then 4
- when 'Friday' then 5
- when 'Saturday' then 6
- when 'Sunday' then 7
- end ;
Add Comment
Please, Sign In to add comment