string - 如何比较字符串和整数 Postgres

标签 string postgresql integer compare

如何在 Postgres 中比较空字符串和整数?

例如: 选择 * From xyz where anynumber = ''

最佳答案

数字列不能为“空白”,但可以为null。我想这就是你想要的:

鉴于 anynumber 可以为空,即

create table xyz (
    ...
    anynumber int,  -- ie not "NOT NULL"
    ...
)

您可以测试空值:

select * From xyz where anynumber is null

关于string - 如何比较字符串和整数 Postgres,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15089982/

相关文章:

c - 如何正确比较 C 中的字符串?

C# Regex.Split 强制结果不转义字符

c - 为什么我可以在 C 中将整数隐式转换为 char

java - 为什么 resultset.next() 返回 null

postgresql - 如何使用 PostgreSQL C 库 (libpq) 访问 HSTORE 列?

c - 谜题: "[] is symmetric"?

perl - "0 but true"在 Perl 中意味着什么?

c++ - 如何用 if 检查字符串数组的第一个元素第一个符号?

C++ 将非英文文本写入文件

sql - 更新规则和 PostgreSQL 中的 ‘column reference is ambiguous’ 错误