Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

whats the difference between '!=' and '<>' in mysql

Tags:

mysql

whats the difference between != and <> in mysql. which symbol is good to user in sql query for not equal condition.can someone tell me whats the pros and cons of using the not equal symbol in mysql.

like image 736
user772900 Avatar asked Aug 12 '11 12:08

user772900


2 Answers

!= requires 3 keystrokes (Shift, !, =), and <> requires 3 keystrokes (Shift, <, >). However a touch typist has to switch hands to hit that =.

You should definitely use <> over !=. You'll save at least 10 milliseconds of typing for each use.

like image 51
Gilbert Le Blanc Avatar answered Oct 19 '22 09:10

Gilbert Le Blanc


There is absolutely no difference in MySQL, but the <> is the variant present in the SQL ISO standard.

If you're interested in trivia I can tell you that Oracle also has ^= apart from those two.

like image 41
Alin Purcaru Avatar answered Oct 19 '22 08:10

Alin Purcaru