一个很简单的难题-T-SQL
来源:百度知道 编辑:UC知道 时间:2024/06/13 23:01:53
在sybase (ASA)数据库中执行以下两个SQL语句:
select count(*) from tba_gescod where c_gesnum in (select c_gesnum from tba_usrges)
得到 159310
select count(*) from tba_gescod
得到 163393
那么请问,我现在执行
select count(*) from tba_gescod where c_gesnum not in (select c_gesnum from tba_usrges)
我将得到一个什么数字呢?
没有那么简单,为什么的得到的数字是 0呢?
哪个可以回答我?
select count(*) from tba_gescod where c_gesnum in (select c_gesnum from tba_usrges)
得到 159310
select count(*) from tba_gescod
得到 163393
那么请问,我现在执行
select count(*) from tba_gescod where c_gesnum not in (select c_gesnum from tba_usrges)
我将得到一个什么数字呢?
没有那么简单,为什么的得到的数字是 0呢?
哪个可以回答我?
汗了。。这破题害苦我了。。
是一定等于0 =。=
因为null值是进行in和not in判断的时候的被忽略掉的。。
就是说null值不进行比较~~
163393 - 159310
163393与159310的差
等于0
163393-159319=4074