0

I just started learning database a couple of days ago. I'm running into this problem where my value is being recognized as a column, and it's spitting out an error.

This is my News table:

id | bodyText | url |  createdAt | updatedAt 
----+----------+-----+-----------+-----------

this is the command I ran in psql:

INSERT INTO "News" ("bodyText") VALUES ("this is a test");

and this is the error I'm getting:

ERROR:  column "this is a test" does not exist
LINE 1: INSERT INTO "News" ("bodyText") VALUES ("this is a ...

I've tried removing the double quotes, adding it, doing it line by line, and so far I haven't come across an answer. Does anyone have an answer to this? Thanks in advance.

kimmo
  • 19
  • 6

1 Answers1

2

Try this:

INSERT INTO "Notifications" ("bodyText") VALUES ('this is a test');
etsa
  • 5,020
  • 1
  • 7
  • 18
  • 1
    In SQL single quote (') is the delimitator for string value. In Postgresql (and some other db) you can use double quote (") to specify exactly (case) the name of the fields (column) or to include in the name some special characters. – etsa Jul 07 '17 at 08:46
  • nice!!!!Thanks for the additional info. You've been such an amazing help!!! – kimmo Jul 10 '17 at 15:15