Sql – the difference between single quotes and double quotes in PostgreSQL

postgresqlsql

I am new to PostgresSQL.I tried

select * from employee where employee_name="elina";

But that results error as follows:

ERROR: column "elina" does not exist.

Then I tried by replacing double quotes with single quotes as follows:

select * from employee where employee_name='elina';

It result fine..So what is the difference between single quotes and double quotes in postgresql.If we can't use double quotes in postgres query,then if any other use for this double quotes in postgreSQL?

Best Solution

Double quotes are for names of tables or fields. Sometimes You can omit them. The single quotes are for string constants. This is the SQL standard. In the verbose form, your query looks like this:

select * from "employee" where "employee_name"='elina';