有人可以解释一下这个查询...... [英] Can some body explain this query ...

查看:83
本文介绍了有人可以解释一下这个查询......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

其实我从这个链接找到了这个查询

http://use-the-index-luke.com/sql/where-clause/obfuscation/smart-logic [ ^ ]

Actually i found this query from this link
http://use-the-index-luke.com/sql/where-clause/obfuscation/smart-logic[^]

SELECT first_name, last_name, subsidiary_id, employee_id
  FROM employees
 WHERE( subsidiary_id    = NULL     OR NULL IS NULL )
   AND( employee_id      = NULL     OR NULL IS NULL )
   AND( UPPER(last_name) = 'WINAND' OR 'WINAND' IS NULL )



解释这是什么意思NULL IS NULL及其功能在哪里?谢谢


Explain what does this mean " NULL IS NULL" and what is its functionality here ?Thanks

推荐答案

NULL IS NULL将只返回true,因此where子句的那一部分完全没有意义,因为无论topic_id字段发生什么,OR的结果总是为真。
NULL IS NULL will simply return true, hence that part of the where clause is completely pointless, as regardless what happens with the subsidiary_id field, the result of the OR will always be true.


这篇关于有人可以解释一下这个查询......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆