Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Sql Server- My current statement: use football select * from team join game on t

ID: 3736667 • Letter: S

Question

Sql Server-

My current statement:

use football
select *
from team join game
on team.teamID = game.winning_team

This is the output:

    teamID teamName             gameID gameDate   gameTime           home_team visitor_team winning_team       refID locationID score
----------- --------------- ----------- ---------- ---------------- ----------- ------------ ------------ ----------- ----------- ----------
        106 Gold Dragons          10000 2012-08-30 18:00:00.0000000         106          104          106         162           2 14 - 3   
        103 Silver Lions          10001 2012-08-30 18:00:00.0000000         103          101          103         161           3 10 - 7   
        102 Red Devils            10002 2012-09-06 18:00:00.0000000         102          106          102         162           2 27 - 14  
        104 Blue Jackets          10003 2012-09-06 18:00:00.0000000         104          103          104         161           3 14 - 7   
        101 Purple Pilots         10004 2012-09-06 18:00:00.0000000         101          105          101         160           1 27 - 7   
        106 Gold Dragons          10005 2012-09-13 18:00:00.0000000         106          104          106         162           1 14 - 7   
        103 Silver Lions          10006 2012-09-13 18:00:00.0000000         103          101          103         160           2 21 - 7   
        105 Green Hornets         10007 2012-09-13 18:00:00.0000000         105          102          105         161           3 21 - 20  
        105 Green Hornets         10012 2012-08-23 18:00:00.0000000         101          105          105         160           2 21 - 10  
        102 Red Devils            10013 2012-08-23 18:00:00.0000000         102          106          102         161           1 14 - 0   
        104 Blue Jackets          10014 2012-08-23 18:00:00.0000000         104          103          104         162           3 24 - 3   
        105 Green Hornets         10015 2012-08-30 18:00:00.0000000         105          102          105         161           1 17 - 14  


I am trying to get the "number of wins" for teams that have two or more wins.

Explanation / Answer

You can run following query to get

"number of wins" for teams that have two or more wins.

select winning_team, teamName, count(winning_team) as number_of_wins

from game inner join team on game.winning_team = team.teamID

group by winning_team having count(winning_team) >=2

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote