Question

1- Consider the following SQL query and related relations          SELECT P.Name FROM Players P, Games G...

1- Consider the following SQL query and related relations         

SELECT P.Name

FROM Players P, Games G

WHERE P.Id = G.PlayerId

AND P.Game = 'Football' AND G.Season ='2019'

where:

Players (Id, Name, Game)

Games (PlayerId, GameCode, Season)

A- Translate the above SQL query to a relational algebra expression.

B- Draw the Query tree for above relational algebra expression in part (a).

Note: Please no screenshot

0 0
Add a comment Improve this question Transcribed image text
Answer #1

SELECT P.Name

FROM Players P, Games G

WHERE P.Id = G.PlayerId

AND P.Game = 'Football' AND G.Season ='2019'

Let us see first symbol which will be used in translating the query in relational algebra:

  1. As Select P.name is to extract a particular column from the table, Projection(π) symbol will be used.

πP.name

  1. Select σ symbol is used to extract tuples from table according to where clause condition

σ Id(Player)= PlayerId(Games)

So the relational algebra expression for the following part of Sql Query :

SELECT P.Name

FROM Players P, Games G

WHERE P.Id = G.PlayerId

is

πP.nameId(Player)= PlayerId(Games))

  1. Now we create relational algebra expression using AND for the full query as

π Player.nameId(Player)= PlayerId(Games) and σGame=’FootBall’(Player) and σseason=2019(Games))( Player X Games)

Where Player X Games shows Cartesian product to merge two relations Player and Games.

Query Tree


Add a comment
Know the answer?
Add Answer to:
1- Consider the following SQL query and related relations          SELECT P.Name FROM Players P, Games G...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT