World Cup Database - Build a World Cup Database

  • When you run your insert_data.sh script, it should add each unique team to the teams table. There should be 24 rows

the files have right permissions but i don’t know how i can insert the data into my PSQL database ?

Your browser information:

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

Challenge: World Cup Database - Build a World Cup Database

Link to the challenge:

What have you tried to do that didn’t work?
For eg. you probably tried adding code to parse the csv file and insert it using sql in your script? Maybe share the script and any debugging you did with us so we have somewhere to start that is the same page as you.

My games.cvc script= year,round,winner,opponent,winner_goals,opponent_goals
2018,Final,France,Croatia,4,2
2018,Third Place,Belgium,England,2,0
2018,Semi-Final,Croatia,England,2,1
2018,Semi-Final,France,Belgium,1,0
2018,Quarter-Final,Croatia,Russia,3,2
2018,Quarter-Final,England,Sweden,2,0
2018,Quarter-Final,Belgium,Brazil,2,1
2018,Quarter-Final,France,Uruguay,2,0
2018,Eighth-Final,England,Colombia,2,1
2018,Eighth-Final,Sweden,Switzerland,1,0
2018,Eighth-Final,Belgium,Japan,3,2
2018,Eighth-Final,Brazil,Mexico,2,0
2018,Eighth-Final,Croatia,Denmark,2,1
2018,Eighth-Final,Russia,Spain,2,1
2018,Eighth-Final,Uruguay,Portugal,2,1
2018,Eighth-Final,France,Argentina,4,3
2014,Final,Germany,Argentina,1,0
2014,Third Place,Netherlands,Brazil,3,0
2014,Semi-Final,Argentina,Netherlands,1,0
2014,Semi-Final,Germany,Brazil,7,1
2014,Quarter-Final,Netherlands,Costa Rica,1,0
2014,Quarter-Final,Argentina,Belgium,1,0
2014,Quarter-Final,Brazil,Colombia,2,1
2014,Quarter-Final,Germany,France,1,0
2014,Eighth-Final,Brazil,Chile,2,1
2014,Eighth-Final,Colombia,Uruguay,2,0
2014,Eighth-Final,France,Nigeria,2,0
2014,Eighth-Final,Germany,Algeria,2,1
2014,Eighth-Final,Netherlands,Mexico,2,1
2014,Eighth-Final,Costa Rica,Greece,2,1
2014,Eighth-Final,Argentina,Switzerland,1,0
2014,Eighth-Final,Belgium,United States,2,1
And isert_data.sh = #! /bin/bash

if [[ $1 == “test” ]]
then
PSQL=“psql --username=postgres --dbname=worldcuptest -t --no-align -c”
else
PSQL=“psql --username=freecodecamp --dbname=worldcup -t --no-align -c”
fi

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

i cannot tell where you script starts…
Usually the first line of a script is #!/bin/bash

Not sure what all those lines at the start of your post are (are they part of the script?).

The idea is to use some code to read or parse the file given to you and insert the data into the tables. I don’t see much evidence that you have done that.