After I build my World Cup Database, I found that my output is the same as the given output for checking. But the coderoad does not give me a pass.
My code so far
echo -e "\nTotal number of goals in all games from winning teams:"
echo "$($PSQL "SELECT SUM(winner_goals) FROM games")"
echo -e "\nTotal number of goals in all games from both teams combined:"
echo "$($PSQL "select sum(winner_goals)+sum(opponent_goals) from games")"
echo -e "\nAverage number of goals in all games from the winning teams:"
echo "$($PSQL "select avg(winner_goals) from games")"
echo -e "\nAverage number of goals in all games from the winning teams rounded to two decimal places:"
echo "$($PSQL "select round(avg(winner_goals),2) from games")"
echo -e "\nAverage number of goals in all games from both teams:"
echo "$($PSQL "select (avg(winner_goals)+avg(opponent_goals)) from games")"
echo -e "\nMost goals scored in a single game by one team:"
echo "$($PSQL "select max(winner_goals) from games")"
echo -e "\nNumber of games where the winning team scored more than two goals:"
echo "$($PSQL "select count(*) from games where winner_goals>2")"
echo -e "\nWinner of the 2018 tournament team name:"
echo "$($PSQL "select name from teams full join games on teams.team_id=games.winner_id where year=2018 and round='Final'")"
echo -e "\nList of teams who played in the 2014 'Eighth-Final' round:"
echo "$($PSQL "select name from teams inner join games on teams.team_id=games.winner_id or teams.team_id=games.opponent_id where year=2014 and round='Eighth-Final' order by name")"
echo -e "\nList of unique winning team names in the whole data set:"
echo "$($PSQL "select distinct(name) from games left join teams on teams.team_id=games.winner_id order by name")"
echo -e "\nYear and team name of all the champions:"
echo "$($PSQL "select year, name from games left join teams on teams.team_id=games.winner_id where round='Final' order by year")"
echo -e "\nList of teams that start with 'Co':"
echo "$($PSQL "select name from teams where name like 'Co%' order by name")"
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36
Challenge: Build a World Cup Database
Link to the challenge: