World Cup Database - Build a World Cup Database

Tell us what’s happening:

I am getting this prompt from CodeRoad
SUBTASKS 1.1 :9 Your “insert_data.sh” script should add each unique team to the “teams” table
This is after I had written the script to insert the necessary data into the database and it gave the expected result.

THIS IS THE CODE

echo $($PSQL "TRUNCATE teams, games")

  cat games.csv | while IFS="," read YEAR ROUND WINNER OPPONENT WINNER_GOALS OPPONENTS_GOALS
  do
    if [[ $YEAR != "year" ]]
    then
      WINNER_ID=$($PSQL "SELECT team_id FROM teams WHERE name='$WINNER'")
      if [[ -z $WINNER_ID ]]
      then
        $PSQL "INSERT INTO teams(name) VALUES('$WINNER')"
      fi
      OPPONENT_ID=$($PSQL "SELECT team_id FROM teams WHERE name='$OPPONENT'")
      if [[ -z $OPPONENT_ID ]]
      then
        $PSQL "INSERT INTO teams(name) VALUES('$OPPONENT')"
      fi
      WINNER_ID=$($PSQL "SELECT team_id FROM teams WHERE name='$WINNER'")
      OPPONENT_ID=$($PSQL "SELECT team_id FROM teams WHERE name='$OPPONENT'")
      INSERT_INTO_GAME_RESULT=$($PSQL"INSERT INTO games(year, round, winner_id, opponent_id, winner_goals, opponent_goals) VALUES($YEAR, '$ROUND', $WINNER_ID, $OPPONENT_ID, $WINNER_GOALS, $OPPONENTS_GOALS)")
    fi

Challenge Information:

World Cup Database - Build a World Cup Database

Make sure you are inserting into the worldcup database and not the worldcuptest database also make sure there aren’t any duplicates. query
SELECT DISTINCT(name) FROM teams and make sure it outputs the correct number of rows.