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

查看:39
本文介绍了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 looks like this:

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

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

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