World Cup Database - Build a World Cup Database

Tell us what’s happening:

You should correctly complete the queries in the queries.sh file. Fill in each empty echo command to get the output of what is suggested with the command above it. Only use a single line like the first query. The output should match what is in the expected_output.txt file exactly, take note of the number of decimal places in some of the query results

Your code so far

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36

Challenge Information:

World Cup Database - Build a World Cup Database

Please Tell us what’s happening in your own words.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more you say, the more we can help!

hi my error is like this, SUBTASKS 1.1 :11 You should correctly complete the “queries.sh” file even though may queries.sh is correct

#! /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 + 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(game_id) FROM games WHERE winner_goals > 2")"

echo -e "\nWinner of the 2018 tournament team name:"

echo "$($PSQL "SELECT name FROM teams INNER 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 LEFT 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 ASC")"

echo -e "\nList of unique winning team names in the whole data set:"

echo "$($PSQL " SELECT name FROM teams INNER JOIN games ON teams.team_id = games.winner_id GROUP BY name ORDER BY name ASC")"

echo -e "\nYear and team name of all the champions:"

echo "$($PSQL "SELECT year, name FROM games INNER JOIN teams ON games.winner_id = teams.team_id WHERE round = 'Final'")"

echo -e "\nList of teams that start with 'Co':"

echo "$($PSQL "SELECT name FROM teams WHERE name LIKE 'Co%'")"

If all you can say is that you know your code is perfect, then unfortunately that doesn’t really leave anything for me to say.

i did not say it is perfect, but i’m just asking why i can’t complete the task below even though i did it?

can you pls help, tell me where part of the code did i make a mistake

Welcome to the forum @envy1815

Test out each echo in the terminal.
Make sure the decimal placing, if any, is exactly the same as the expected output.

Happy coding