x / D Assign2(2).pdfD M4 ExtendedRA x D M3-SQL(1) pdf x \\ D Assign2(2).pdf > E
ID: 3876117 • Letter: X
Question
x / D Assign2(2).pdfD M4 ExtendedRA x D M3-SQL(1) pdf x D Assign2(2).pdf > E eligensee gene E Heiligensee-Ab: X Secure https://myasucourses asu.edu/bbcswebdav/pid-17821265-dt content-rid-1 198304501/courses/2018SpringAX-SER322 20993/Assign2%20962829629 pdf Week 2 (Jan 15- Inagi : Apps FSAID ASURITESign in Java Platform Standa - Exercise 3 of Lesson Rent BuyTextbooks G Google , How to determine a -Java Game Program Account Summary The database you will use for this assignment contains information related to Major League Baseball (MLB) about players, teams, and games. The relations are Players(playerlD, playerName, team, position, birthYear) playerlD is a player identifier used in MLB, and all players throughout the history of baseball have a unique ID playerName is player's name team is the name of the MLB team the player is currently playing on (or the last team the player played for if they are not currently playing) position is the position of the player birthYear is the year that player was born . . e . . Teams(teamID, teamName, home, leagueName) teamID is a unique ID internal to MLB. teamName is the name of the team e home is the home city of the team leagueName is the league the team is in, i.e. either "National or American", which stands for "National League" and "American League", respectively Games(gamelD, homeTeamID, guestTeamID, date) gamelD is a unique ID used internally in MLB homeTeamID is the ID of the hometeam guestTeamID is the ID of the visiting team date is the date of the game . e A sample instance of this database is given at the end of this homework handout. Since it is just one instance of the database designed to give you some intuition, you should not "customize" vour answer to work onlv with this instance M4-ExtendedRA.pdf @i] M3.SQL(1).pdf Show all | × ^Explanation / Answer
a)
SELECT DISTINCT hometeamid FROM games WHERE
guestteamid = (SELECT teamid FROM teams WHERE teamname = 'Phillies')
AND guestteamid != (SELECT teamid FROM teams WHERE teamname = 'Braves')
UNION DISTINCT
SELECT DISTINCT guestteamid FROM games WHERE
hometeamid = (SELECT teamid FROM teams WHERE teamname = 'Phillies')
AND hometeamid != (SELECT teamid FROM teams WHERE teamname = 'Braves');
b)
SELECT a.playerid "playerID1", b.playerid "playerID2", a.team
FROM players a INNER JOIN players b
ON a.team = b.team
AND a.playerid != b.playerid
AND a.playerid < b.playerid;
c)
SELECT a.hometeamid "teamID1", b.leaguename "league1", a.guestteamid "teamID2", c.leaguename "league2", a.date
FROM games a INNER JOIN teams b
ON a.hometeamid = b.teamid
INNER JOIN teams c
ON a.guestteamid = c.teamid
WHERE
b.leaguename != c.leaguename;
d)
SELECT DISTINCT a.home
FROM teams a INNER JOIN teams b
ON a.home = b.home
AND a.teamname != b.teamname
AND a.leaguename != b.leaguename;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.