=和IS mysql之间的区别

=和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 .