这让我大吃一惊.
我想做的就是在长varchar场上进行基本的字符串比较.
我有一张大约一张桌子.12M记录.
如果我查询MY_FIELD='a string',我得到25947的计数,这似乎是正确的.
如果我查询MY_FIELD!='a string',我得到989的计数.
这两个计数不应该相加到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';
Run Code Online (Sandbox Code Playgroud)
NULL是不等于或不等于任何价值,包括NULL所以我期望d+e等同于c和b+c等于a.
| 归档时间: |
|
| 查看次数: |
2708 次 |
| 最近记录: |