=和IS mysql之间的区别 [英] Difference between = and IS mysql

查看:198
本文介绍了=和IS mysql之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我目前在一个具有交互式MySQL Shell提示符的站点上.

So I am on a site at the moment where it has an interactive MySQL Shell prompt.

我一直在寻找一个朋友问的问题,即为什么当我使用关键字IS时查询失败,但是当我使用=符号时却有效?"

I was looking up a question that a friend asked which is "why does the query fail when I use the keyword IS but it works when I use the = symbol?"

所以我进行了测试,并确定它确实失败了.

So I tested it out and sure enough it does fail.

SELECT name, continent, population FROM world WHERE continent IS 'Asia'失败,但SELECT name, continent, population FROM world WHERE continent = 'Asia'正常.

我尝试使用Google搜索来寻找答案,但无济于事.

I have tried googling for an answer but no avail.

任何帮助都会很棒!

推荐答案

IS 对布尔值(不为True/False/NULL)进行测试,其中

IS tests against a boolean(True/False/NULL neither) where as = tests equivalency

IS只能用于返回true,false或NULL的变量.

IS can only be used against variables that return true, false or NULL .

这篇关于=和IS mysql之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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