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?
Single quotes are used to indicate the beginning and end of a string in SQL. Double quotes generally aren't used in SQL, but that can vary from database to database. Stick to using single quotes.
The main difference between double quotes and single quotes is, double quotes are used to denote a speech or a quotation whereas single quotes are used to indicate quote within a quotation.
The most common reason to use single quotation marks is to quote someone who is quoting someone else. The rules are different in British English, but in American English, you enclose the primary speaker's comments in double quotation marks, and then you enclose the thing they are quoting in single quotation marks.
Quotes and double quotes should be escaped using \.
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';
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With