KechevD

СУБД-Задачи за 17.03

Mar 17th, 2020
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. 1.
  2. select * from sportGroups
  3. where location = 'Sofia-Lyulin 1';
  4.  
  5. 2.
  6. select * from students
  7. where id = 2;
  8.  
  9. 3.
  10. select * from sportGroups
  11. where location = 'Sofia-Lyulin 1' or location = 'Sofia-Mladost 7';
  12.  
  13. 4.
  14. select * from sports
  15. order by name;
  16.  
  17. 5.
  18. select * from coaches
  19. where egn = '0250054873';
  20.  
  21. 8.
  22. select * from students
  23. where id >= 1 and id <= 3;
  24.  
  25. 9.
  26. select students.name, sports.name
  27. from students join sports
  28. on students.id in(
  29. select student_id
  30. from student_sport
  31. where student_sport.student_id = sports.id
  32. );
  33.  
  34. 10.
  35. select students.name, students.class, sportgroups.id
  36. from students join sportgroups
  37. on students.id in(
  38. select student_id
  39. from student_sport
  40. where student_sport.student_id = sportgroups.id
  41. )
  42. where sportgroups.dayOfWeek = 'Sunday';
  43.  
  44. 11.
  45. select coaches.name, sports.name
  46. from coaches join sports
  47. on coaches.id in(
  48. select coach_id
  49. from sportgroups
  50. where sportgroups.sport_id = sports.id
  51. )
  52. where sports.name = 'football';
Add Comment
Please, Sign In to add comment