What is the exact Di开发者_运维知识库fference between <> and != ?
None whatsoever, syntactically.
Both are inequality operators, <>
is the SQL-92 standard, however its interchangable on some platforms with !=
(E.g. SQL Server)
<>
is the only inequality operator in the SQL Standard.
Lot's of SQL database systems support the use of !=
including PostgreSQL, SQL Server, MySQL, SQLite, Oracle & Firebird, but some don't, including Apache Derby.
In Oracle there is no difference. Can't speak for all other databases.
There is no difference, at least for MySQL.
See: http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html
Both are used in SQL Server. Both are used for same purpose. SQL Server 2000 and its previous version don't support != but SQL Server 2005 and SQL Server 2008 supports both <> and !=
Functionally there's no difference.
I think this is a matter of programmer preference: '<>' may be preferred by programmers who use various flavors of Pascal or Basic, while '!=' may be preferred by those who use languages which are descendants of C (e.g. C++, Java, C#). Interestingly, though, the C-style equality comparison operator ('==') is not supported in Oracle - how about in other flavors of SQL?
Share and enjoy.
精彩评论