Difference between = and IS mysql

Viewed 835

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

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' failed but SELECT name, continent, population FROM world WHERE continent = 'Asia' works fine.

I have tried googling for an answer but no avail.

Any help would be great!

1 Answers

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

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

Related