gpt4 book ai didi

sql - 如何按空或零长度进行选择?

转载 作者:行者123 更新时间:2023-11-29 14:20:59 24 4
gpt4 key购买 nike

我有疑问:

select text_b, id from articles where title is not null;

但我想显示 text_b 不为空且 text_b 的长度 > 0 的结果。怎么做?

最佳答案

select text_b, id 
from articles
where title is not null
and length(text_b) > 0;

select text_b, id 
from articles
where title is not null
and text_b <> '';

或正确处理 text_b 中的 null

select text_b, id 
from articles
where title is not null
and text_b is distinct from '';

关于sql - 如何按空或零长度进行选择?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27027951/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com