Click here to Skip to main content
15,891,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Actually i found this query from this link
http://use-the-index-luke.com/sql/where-clause/obfuscation/smart-logic[^]
SQL
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 )

Explain what does this mean " NULL IS NULL" and what is its functionality here ?Thanks
Posted
Comments
ArunRajendra 19-Nov-13 0:40am    
there is a issue with the query. subsidiary_id = NULL should be IS null.

1 solution

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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900