Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL fundamental question '!=' vs '<>' vs 'Not' [duplicate]

Possible Duplicate:
Testing for inequality in T-SQL

Hi,

does there any different to use the '!=' vs '<>' vs 'Not'?

which one will have the worst performance

or it exist just because of the backward compatibility syntax?

like image 443
mengchew0113 Avatar asked Sep 17 '10 06:09

mengchew0113


2 Answers

  • NOT does not always act the same
  • != or <> are identical, no deprecation mentioned. <> is ISO though
like image 81
gbn Avatar answered Sep 30 '22 18:09

gbn


AFAIK, if you want to check for NULL, you must use IS NOT and not != or <>

like image 28
alxx Avatar answered Sep 30 '22 17:09

alxx