0

I am new to posrgresql. I created a table called games where I have three columns: country, games, year. I am trying to insert some data to it using this code:

insert into games values("USA", "Baseball", 2012), ("China", "Wrestling", 2011), ("England", "Cricket", 2015), ("India", "Cricket", 2011), ("USA", "Football", 2018), ("Spain", "Football", 2014), ("China", "Basketball", 2019), ("Italy", "Football", 2017);

I am getting this error: ERROR: column "USA" does not exist LINE 2: values("USA", "Baseball", 2012),

What is wrong here? Thanks in advance.

Rashida
  • 401
  • 7
  • 18
  • 4
    You need to change double quotes to a single one. Double quotes are for names of tables or fields. The single quotes are for string constants. https://dbfiddle.uk/?rdbms=postgres_14&fiddle=6eb43c370a391a33c16acc925c9e5084 – Jesusbrother May 10 '22 at 16:01
  • Also, it's strongly suggested that you name the columns while inserting, as in `insert into games (country, sport, year) values('USA', 'Baseball', 2012), ...`. – The Impaler May 10 '22 at 16:07
  • https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS –  May 10 '22 at 18:13

0 Answers0