What is the difference between single quotes and double quotes in PostgreSQL?

前端 未结 3 1914
终归单人心
终归单人心 2020-11-27 05:15

I am new to PostgresSQL.I tried

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

But that results error as follows:

E         


        
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-27 05:48

    Well single quotes are used for string literals and double quotes are used for escaping DB objects like table name / column name etc.

    Specifically, double quotes are used for escaping a column/table name if it's resemble to any reserve/key word. Though every RDBMS have their own way of escaping the same (like backtique in MySQL or square bracket in SQL Server) but using double quotes is ANSI standard.

提交回复
热议问题