微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

mysql中操作符的意思

<span style="font-size:14px;"><span style="color:rgb(51,51,51);font-family:'Lucida Grande',Verdana,'Bitstream Vera Sans',Arial,sans-serif;">MysqL中操作符<=>是安全等于的意思。<br style="color:rgb(51,sans-serif;"><span style="color:rgb(51,sans-serif;">是比较运算符,当比较的值含有null值的时候,来返回一个布尔值。比如:<br style="color:rgb(51,sans-serif;">select 1<=>null -- 结果为0

null -- 结果为1。

内容:

nofollow">http://kb.cnblogs.com/page/203622/

<ul style="font-family:verdana,Helvetica,sans-serif;color:rgb(35,35,35);list-style:none;"><li style="font-size:14px;list-style:disc;"> <span style="color:rgb(51,51);">问题 :

<p style="font-family:verdana,sans-serif;font-size:14px;color:rgb(35,35);">
  我在看以前的一个开发者的代码时看到


<div class="cnblogs_code" style="font-family:'Courier New';font-size:14px;border:1px solid rgb(204,204,204);overflow:auto;line-height:25.200000762939453px;color:rgb(35,35);">
<pre style="margin-left:2em;font-family:'Courier New';font-size:12px;"><span style="color:rgb(0,255);">WHERE p.name <span style="color:rgb(128,128,128);"><=> <span style="color:rgb(0,255);">NULL

在这个查询语句中 <=>符号是什么意思啊?是不是和 =号是一样啊?还是一个语法错误啊?但是没有显示任何错误或者异常。我已经知道了MysqL中的 <> = !=等符号。

    ’B'得0和’a'<=>’a‘得1。

    ,

      'a' <=> NULL 得0   NULL<=> NULL 得出 1。和=运算符正相反,=号运算符规则是 'a'=NULL 结果是NULL 甚至NULL = NULL 结果也是NULL。顺便说一句,MysqL上几乎所有的操作符和函数都是这样工作的,因为和NULL比较基本上都没有意义。

      disc;">

    一个一致的语句。

    col_a ? ...

    运算符时,你没有必要对查询语句做任何修改

      ,还有两个其他的操作符用来处理某个值和NULL做比较,也就是IS NULL and IS NOT NULL。他们是ANSI标准中的一部分,因此也可以用在其他数据库中。而<=>只能在MysqL中使用。

      当作MysqL中的方言。

      <span style="color:rgb(255,255);">IS <span style="color:rgb(128,128);">NOT <span style="color:rgb(0,255);">NULL <span style="color:rgb(128,128);">==> <span style="color:rgb(128,128);">NOT(<span style="color:rgb(255,255);">NULL)

      查询语句段改的更具移植性一点:

      p.name

      版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

      相关推荐