World Cup Database - Stuck

I’m not sure if I missed something but i’m stuck a this following step:

image

Here’s my script:

cat games.csv | while IFS="," read YEAR ROUND WINNER OPPONENT WINNER_GOALS OPPONENT_GOALS
do
  if [[ $OPPONENT != "opponent" ]]
  then
    #get count to check if name already exists
    NAME=$($PSQL "SELECT COUNT(team_id) FROM teams WHERE name ='$OPPONENT'")

    #echo $OPPONENT
    #echo $NAME
    
    if [[ $NAME -eq 0 ]]
    then
      INSERT_TEAM_RESULT=$($PSQL "INSERT INTO teams(name) VALUES ('$OPPONENT')")
      if [[ $INSERT_TEAM_RESULT == "INSERT 0 1" ]]
      then
        echo Inserted into team, $OPPONENT
      fi
    fi
  fi
done

I might have an Ideia on why is not working. It might be that it’s only inserting 23 rows instead of 24 wich is odd because if you remove all the duplicates from the csv file it only has 23 entries as well.

Is it my fault or there are people that are stuck here as well?

#Edit just a disclaimer about the duplicates, i’m talking about the opponents column on the csv file.

I’m going to check on this tomorrow morning to see if it works but I think this is it. I was only looking in the opponent column in the csv file. And you’re right about looking for the specific Id rather than some other random column, noted.

Thank you regardless.

You were right now it shows 24.
image

Sorry but we can’t share solutions here.

hbart1st, Should I delete my answer in this post?

Yes please delete it