Syntax Error World Cup Database - Build a World Cup Database

Tell us what’s happening:

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?

Thank you.

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/139.0.0.0 Safari/537.36 Edg/139.0.0.0

Challenge Information:

World Cup Database - Build a World Cup Database

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)

Thank you,

I added a $ like below and it now works.

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’”)

I’m not sure what you’re asking me I’m afraid.

The difference is usually between 2 things. What 2 things are you asking about?

I did not need the $ in the below select statement in order for the insert script to function.

I did need the $ in the below select statement for the insert script to function.

Hi @codecampacct

One is an INSERT the other is a SELECT.

For the one without the dollar sign ($), check what the table contents look like.

Happy coding

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.