码迷,mamicode.com
首页 > 其他好文 > 详细

NULL-safe equal

时间:2016-12-29 20:13:36      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:class   for   operator   term   color   link   val   ref   one   

http://dev.mysql.com/doc/refman/5.7/en/comparison-operators.html#operator_equal-to

SELECT 1=1,1=NULL,0=NULL,NULL=NULL;

1 NULL NULL NULL

SELECT 1<=>1,1<=>NULL,0<=>NULL,NULL<=>NULL;

1 0 0 1

 

<=>

NULL-safe equal. This operator performs an equality comparison like the = operator, but returns 1 rather than NULL if both operands are NULL, and 0rather than NULL if one operand is NULL.

The <=> operator is equivalent to the standard SQL IS NOT DISTINCT FROM operator.

For row comparisons, (a, b) <=> (x, y) is equivalent to:

(a <=> x) AND (b <=> y)

 

NULL-safe equal

标签:class   for   operator   term   color   link   val   ref   one   

原文地址:http://www.cnblogs.com/yuanjiangw/p/6234565.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!