gpt4 book ai didi

db2 - 如何匹配 DB2 (z/OS) 查询中的字符串?

转载 作者:行者123 更新时间:2023-12-01 11:07:19 25 4
gpt4 key购买 nike

这让我大吃一惊。

我想做的只是在长 varchar 字段上进行基本字符串比较。

我有一张大约的 table 。 1200 万条记录。

如果我查询 MY_FIELD='a string',我得到的计数是 25947,这似乎是正确的。

如果我查询 MY_FIELD!='a string',我得到的计数是 989。

这 2 个计数加起来不应该是 12M 的完整表大小吗?

最佳答案

其中有多少行的 MY_FIELD 设置为 NULL

a. select count(*) from mytable;
b. select count(*) from mytable where my_field is null;
c. select count(*) from mytable where my_field is not null;
d. select count(*) from mytable where my_field = 'some value';
e. select count(*) from mytable where my_field != 'some value';

NULL 不等于或不等于任何 值,包括 NULL 所以我期望 d+e等同于 cb+c 等同于 a

关于db2 - 如何匹配 DB2 (z/OS) 查询中的字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4087732/

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