Advertisement
Radoslav_03

sports

Mar 5th, 2024
1,042
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.47 KB | None | 0 0
  1. SELECT * FROM students ORDER BY name;
  2.  
  3. DELETE FROM students
  4. WHERE egn = "9207186371";
  5.  
  6. SELECT students.name, sport.name
  7. FROM students
  8. JOIN student_sport ON students.id = student_sport.student_id
  9. JOIN sportgroups ON student_sport.sportGroup_id = sportgroups.id
  10. JOIN sports ON sportgroups.sport_id = sports.id;
  11.  
  12. SELECT students.name, students.class, sportgroups.id
  13. FROM students
  14. JOIN student_sport ON students.id = student_sport.student_id
  15. JOIN sportgroups ON student_sport = sportgroups.id
  16. WHERE sportgroups.dayOfWeek = "Monday";
  17.  
  18. SELECT coaches.name
  19. FROM coaches
  20. JOIN sportgroups ON coaches.id = sportgroups.coach_id
  21. JOIN sports ON sportgroups.sport_id = sports.id
  22. Where sports.name = "Football";
  23.  
  24. SELECT sportgroups.location, sportgroups.hourOfTraining, sportgroups.dayOfWeek
  25. FROM sportgroups
  26. JOIN sports ON sportsgroup.sport_id = sports.id
  27. WHERE sports.name = "Voleyball";
  28.  
  29. SELECT sports.name
  30. FROM students
  31. JOIN student_sport ON students.id = students_sport.student_id
  32. JOIN sportgroups ON student_sport.sportGroup_id = sportgroups.id
  33. JOIN sports ON sportgroups.sport_id = sports.id
  34. WHERE students.name = "Iliyan Ivanov";
  35.  
  36. SELECT students.name
  37. FROM students
  38. JOIN student_sport ON students.id = student_sport.student_id
  39. JOIN sportgroups ON student_sport.sportGroup.id = sportgroups.id
  40. JOIN sports ON sportgroups.sport_id = sports.id
  41. JOIN coaches ON sportgroups.coach_id = coaches.id
  42. WHERE sports.name = "Football" AND coaches.name = "Ivan Todorov Petkov";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement