Hello, I am receiving syntax error when trying to insert my insert_data.sh file into the games table. Below is a screenshot of my code and the csv file. What am I missing?
the 2 select statements above the insert are not doing what you think they are doing.
Try to echo their output.
(the error you are getting is happening because you are trying to insert blank winner_id and blank opponent_id but those fields are supposed to be not null)
WINNER_ID=$($PSQL “SELECT team_id FROM teams WHERE name=‘$WINNER’”)
When inserting into the teams table, I was able to use below without issue. Can you please tell me the difference or advise what I should review to know the difference?
TEAM_ID=$($PSQL “SELECT team_id FROM teams WHERE name=‘WINNER’”)