0

I am using SQL query to get a specific user from the table, however, I am running into the issue where the postgresql is telling me that the column does not exist. It is a simple query statement that looks like this:

SELECT username FROM userlogins WHERE username = "test@email.com";

The ERROR:  column "test@email.com" does not exist
a_horse_with_no_name
  • 497,550
  • 91
  • 775
  • 843

1 Answers1

0

In SQL, you use single quotes to delimit strings. You use double quotes to escape identifiers. You simply want:

SELECT username
FROM userlogins
WHERE username = 'test@email.com';

Some databases allow the use of double quotes for strings, but that is generally just confusing -- and Postgres is not one of those databases.

Gordon Linoff
  • 1,198,228
  • 53
  • 572
  • 709