Relational Database (Beta ) World Cup Project

Cannot pass the last test for the project
Error :
SUBBTASKS 1.1 :11 You should correctly complete the “queries.sh” file

which means error on 11 th query? idk

#! /bin/bash

PSQL="psql --username=freecodecamp --dbname=worldcup --no-align --tuples-only -c"

# Do not change code above this line. Use the PSQL variable above to query your database.

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(winner_goals) FROM games WHERE winner_goals > 2")"

echo -e "\nWinner of the 2018 tournament team name:"
echo "$($PSQL "select name from games left  join teams on  games.winner_id=teams.team_id where round='Final' and year=2018")"

echo -e "\nList of teams who played in the 2014 'Eighth-Final' round:"
echo  "$($PSQL "select name from games left  join teams on  games.winner_id=teams.team_id where round='Eighth-Final' and year=2014  union select  name from games left join teams on games.opponent_id=teams.team_id where round='Eighth-Final' and year=2014 order by name asc")"

echo -e "\nList of unique winning team names in the whole data set:"
echo "$($PSQL "select distinct(name) from games left  join teams on  games.winner_id=teams.team_id order by name asc")"

echo -e "\nYear and team name of all the champions:"
echo "$($PSQL "select year,name from games left  join teams on  games.winner_id=teams.team_id where round='Final' order by year asc")"


echo -e "\nList of teams that start with 'Co':"
echo "$($PSQL "SELECT name FROM teams where name like 'Co%'")"

I have matched them with my eyes and i think it matches with the expected output
pls help!!

and error is not verbose enough to rectify the mistake on my own

Thanks!!!

The tests are quite picky here - it needs to match the expected output exactly. I ran your script - I think I set it up correctly, and I see this:
Screen Shot 2022-06-14 at 2.25.10 PM

That last number has extra zero’s on it. Fix that to match the expected output and I think it will pass for you @b-bhupendra.

1 Like