Advertisement
sergei_kolomiitsev

Untitled

Feb 21st, 2024 (edited)
1,017
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 0.65 KB | None | 0 0
  1. https://sql-academy.org/ru/sandbox
  2. 1)
  3. SELECT *
  4. FROM Trip
  5. JOIN Company ON trip.company=company.id
  6. 2)
  7. SELECT plane AS "самолет",
  8.        town_from AS "город вылета",
  9.        name AS "название"
  10. FROM Trip t
  11. JOIN Company c ON t.company=c.id
  12. GROUP BY
  13. 3)
  14. SELECT name AS "название", COUNT(t.id)
  15. FROM Trip t
  16. JOIN Company c ON t.company=c.id
  17. JOIN Pass_in_trip p ON t.id=p.trip
  18. GROUP BY name
  19. 4)
  20. SELECT *
  21. FROM Trip t
  22. JOIN Company c ON t.company=c.id
  23. JOIN Pass_in_trip p ON t.id=p.trip
  24. 5)
  25. SELECT *
  26. FROM Trip t
  27. JOIN Company c ON t.company=c.id
  28. JOIN Pass_in_trip p ON t.id=p.trip
  29. JOIN passenger pr ON pr.id=p.passenger
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement