Due: 11:59 pm on 11/8/2026

Assignment 8

For all of these queries, follow strict SQL rules with respect to attributes in the GROUP BY clause.

Write a single query for each problem. Name is a single field with nameFirst and nameLast concatenated.

  1. Using the "not exists" construct, find the names of all of the players who played on all of the World Series Champions between 2023 and 2025 (inclusive).
  2. Using the set cardinality construct, find the names of all of the players who played on all of the World Series Champions between 2023 and 2025 (inclusive).
  3. Using the set cardinality construct with common table expressions, find the names of all of the players who played on all of the World Series Champions between 2023 and 2025 (inclusive).
  4. Using the "not exists" construct, find the team names of all of the teams which made the playoffs every year the Toronto Blue Jays won the World Series.
  5. Using the set cardinality construct, find the team names of all of the teams which made the playoffs every year the Toronto Blue Jays won the World Series.
  6. Using the set cardinality construct with common table expressions, find the team names of all of the teams which made the playoffs every year the Toronto Blue Jays won the World Series.
  7. Use a common table expression to find the names and franchId of all active franchises (active = 'Y'). Using that CTE, find the number of World Series wins for each franchise, and the year of the last World Series win. You can ignore franshises with no wins. Output the franchise name, the number of WS wins and the last year they won the World Series.
  8. Use a common table expression to find the names and franchId of all active franchises (active = 'Y'). Using that CTE, find the number of World Series wins for each franchise, and the year of the last World Series win. Include the franshises with no wins. Output the franchise name, the number of WS wins and the last year they won the World Series.
  9. Use a common table expression to find the career batting average (H/AB) for all players with at least 1 atbat (AB). Write a query to return the percentage of players with a career batting average greater than the batting average of the entire database. Output the percentage.

Your assignment should be a text file meeting the following criteria