Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use of greater and less than signs together in mysql query <>

Tags:

sql

mysql

What does the <> sign mean in MySQL? I saw it in a query, and could not understand what it is.

like image 336
sqlchild Avatar asked Jan 06 '12 11:01

sqlchild


People also ask

What does <> do in MySQL?

MySQLi For Beginners The symbol <> in MySQL is same as not equal to operator (!=). Both gives the result in boolean or tinyint(1). If the condition becomes true, then the result will be 1 otherwise 0.

Is != And <> same in SQL?

Here is the answer – Technically there is no difference between != and <>. Both of them work the same way and there is absolutely no difference in terms of performance or result.


3 Answers

It means not equal, so these two are equivalent

a != b
a <> b
like image 100
Tom Avatar answered Oct 20 '22 20:10

Tom


Use != operator instead. <> is some oldy goldy way of operating NOT EQUAL TO.

like image 26
Acn Avatar answered Oct 20 '22 20:10

Acn


It means 'Not Equal' just as != means 'Not Equal'.
Literally the symbols mean less than and greater than. Since those two operators are mutually exclusive, putting them together is an impossibility and therefore, NOT EQUAL.

like image 25
EricB Avatar answered Oct 20 '22 18:10

EricB