postgresql中null對!=的影響


今天開發問我,為什么!=操作不能獲取值為null記錄:

abce=# select id,
abce-#         a_no,
abce-#         a_code,
abce-#         a_number,
abce-#         date_receive,
abce-#         bank_a,
abce-#         status
abce-# from
abce-#         erp_a_examine 
abce-# where
abce-#         ( a_number = '1023' and a_code = '231174' and status != '已作廢' );
 id  | a_no | a_code | a_number | date_receive | bank_a | status 
-----+------+--------+----------+--------------+--------+--------
(0 rows)

abce=# select id,
abce-#         a_no,
abce-#         a_code,
abce-#         a_number,
abce-#         date_receive,
abce-#         bank_a,
abce-#         status
abce-# from
abce-#         erp_a_examine 
abce-# where
abce-#         ( a_number = '1023' and a_code = '231174' );
 id  | a_no | a_code | a_number | date_receive | bank_a | status 
-----+------+--------+----------+--------------+--------+--------
 333 | 1023 | 231174 | 12155    | 2010-03-02   |        | 
(1 row)

abce=# 

  

只是因為null是非safe的操作。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM