Question

How to retrieve 'Player Name and Team Name'  teams which have more than one goals in the...

How to retrieve 'Player Name and Team Name'  teams which have more than one goals in the tournament?

Suppose I have 3 tables Goals, Player and Team.

Goals Table contain TEAM ID , GAME ID , FOR_TEAM ID. ( Here , FOR_TEAM ID is id of opposition team)

Player Table contain TEAM ID, PLAYER NAME and Player ID

Team Table contain TEAM ID, TEAM NAME

I need working SQL QUERY

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

select PLAYERNAME, TEAMNAME from Player

select PLAYERNAME, TEAMNAME from Player
inner join Team on Team.TEAM_ID = Player.PLAYER_ID
onne join Goals on Goals.TEAM_ID = Player.PLAYER_ID
group by PLAYERNAME
having count(Goals.FOR_TEAMID) > 1;

select PLAYERNAME, TEAMNAME from Player, Team, Goals
where Team.TEAM_ID = Player.PLAYER_ID and
Goals.TEAM_ID = Player.PLAYER_ID
group by PLAYERNAME
having count(Goals.FOR_TEAMID) > 1;

both queries can be used.

having -> display the selected rows with the condition

inner join - > join the rows with more than one table

Add a comment
Know the answer?
Add Answer to:
How to retrieve 'Player Name and Team Name'  teams which have more than one goals in the...
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
ADVERTISEMENT