Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need answer in relational algebra pls! The database you will use for this assignment contains information related to Major League Baseball (MLB) about players,

I need answer in relational algebra pls!

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(playerID, playerName, team, position, birthYear)

playerID is a player identifier used in MLB, and all players throughout the history of baseball have a unique ID

playerName is players 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 Teams(teamID, teamName, home, leagueName)

teamID is a unique ID internal to MLB.

teamName is the name of the team

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(gameID, homeTeamID, guestTeamID, date)

gameID 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.

Write the following queries in relational algebra, using the schema provided above. If a query is long, feel free to break it up into a series of queries with intermediate answers stored in temporary relations (e.g. let temp =.....). Note: Your queries must not be state-dependent", that is, they should work without modification even if another instance of the database is given. You may also use just the first letter of each relation name since they are unique (e.g. P" for Players"). (a) Print the names of all players who were born in 1970 and played for the Braves.

(b) Print the names of teams that do not have a pitcher.

(c) Print names of all players who have played in the National League.

(d) Print all gameIDs with Phillies as the home team.

(e) Print all teamIDs where the team played against the Phillies but not against the Braves.

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(playerID, playerName, team, position, birthYear)

playerID is a player identifier used in MLB, and all players throughout the history of baseball have a unique ID

playerName is players 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 Teams(teamID, teamName, home, leagueName)

teamID is a unique ID internal to MLB.

teamName is the name of the team

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(gameID, homeTeamID, guestTeamID, date)

gameID 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.

Write the following queries in relational algebra, using the schema provided above. If a query is long, feel free to break it up into a series of queries with intermediate answers stored in temporary relations (e.g. let temp =.....). Note: Your queries must not be state-dependent", that is, they should work without modification even if another instance of the database is given. You may also use just the first letter of each relation name since they are unique (e.g. P" for Players"). (a) Print the names of all players who were born in 1970 and played for the Braves.

(b) Print the names of teams that do not have a pitcher.

(c) Print names of all players who have played in the National League.

(d) Print all gameIDs with Phillies as the home team.

(e) Print all teamIDs where the team played against the Phillies but not against the Braves.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

Students also viewed these Databases questions