World Cup DB won't accept correct queries

I’ve worked through the World Cup Database challenge and my queries.sh file outputs the same as the expected_output.txt - I’ve piped it into a separate .txt and can’t find a difference (and neither can the diff command) - but the test refuses to pass. Can someone help me out?

Here’s my queries.sh file:

Here’s the expected_output.txt:

Total number of goals in all games from winning teams:
68

Total number of goals in all games from both teams combined:
90

Average number of goals in all games from the winning teams:
2.1250000000000000

Average number of goals in all games from the winning teams rounded to two decimal places:
2.13

Average number of goals in all games from both teams:
2.8125000000000000

Most goals scored in a single game by one team:
7

Number of games where the winning team scored more than two goals:
6

Winner of the 2018 tournament team name:
France

List of teams who played in the 2014 ‘Eighth-Final’ round:
Algeria
Argentina
Belgium
Brazil
Chile
Colombia
Costa Rica
France
Germany
Greece
Mexico
Netherlands
Nigeria
Switzerland
United States
Uruguay

List of unique winning team names in the whole data set:
Argentina
Belgium
Brazil
Colombia
Costa Rica
Croatia
England
France
Germany
Netherlands
Russia
Sweden
Uruguay

Year and team name of all the champions:
2014|Germany
2018|France

List of teams that start with ‘Co’:
Colombia
Costa Rica

And my query_output.txt for comparison:

Total number of goals in all games from winning teams:
68

Total number of goals in all games from both teams combined:
90

Average number of goals in all games from the winning teams:
2.1250000000000000

Average number of goals in all games from the winning teams rounded to two decimal places:
2.13

Average number of goals in all games from both teams:
2.8125000000000000

Most goals scored in a single game by one team:
7

Number of games where the winning team scored more than two goals:
6

Winner of the 2018 tournament team name:
France

List of teams who played in the 2014 ‘Eighth-Final’ round:
Algeria
Argentina
Belgium
Brazil
Chile
Colombia
Costa Rica
France
Germany
Greece
Mexico
Netherlands
Nigeria
Switzerland
United States
Uruguay

List of unique winning team names in the whole data set:
Argentina
Belgium
Brazil
Colombia
Costa Rica
Croatia
England
France
Germany
Netherlands
Russia
Sweden
Uruguay

Year and team name of all the champions:
2014|Germany
2018|France

List of teams that start with ‘Co’:
Colombia
Costa Rica

If anyone could spot why this isn’t working, I’d be very grateful!

Double check those figures that end in many 0’s.

One of them you need to truncate to a specific number of decimals.

They all match in the info you’ve posted here, so I think there’s some kind of mistake…

Actually it’s correct, we just calculated the number differently.

This is how I did this one, if you want to try and see if it makes a difference:

echo -e "\nAverage number of goals in all games from both teams:"
echo "$($PSQL "SELECT ROUND(AVG(winner_goals) + AVG(opponent_goals),16) FROM games")"

Your way seems cleaner and gets the same number.

1 Like

Success! Thanks for that. Frustrating that you have to be so specific but very glad to have that out of the way!