PostgreSQL中的单引号和双引号有什么区别? [英] What is the difference between single quotes and double quotes in PostgreSQL?

查看:135
本文介绍了PostgreSQL中的单引号和双引号有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是PostgresSQL的新手.我尝试过

I am new to PostgresSQL.I tried

select * from employee where employee_name="elina";

但是结果如下:

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';

结果很好..那么,postgresql中的单引号和双引号有什么区别.如果我们不能在postgres查询中使用双引号,那么在postgreSQL中是否还有其他双引号呢?

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?

推荐答案

双引号用于表或字段的名称.有时您可以忽略它们.单引号用于字符串常量.这是SQL标准.在详细形式中,您的查询如下所示:

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 look like this:

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

这篇关于PostgreSQL中的单引号和双引号有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆