Should I use != or <> for not equal in T-SQL?

前端 未结 14 1990
失恋的感觉
失恋的感觉 2020-11-22 04:23

I have seen SQL that uses both != and <> for not equal. What is the preferred syntax and why?

14条回答
  •  说谎
    说谎 (楼主)
    2020-11-22 04:57

    Most databases support != (popular programming languages) and <> (ANSI).

    Databases that support both != and <>:

    • MySQL 5.1: != and <>
    • PostgreSQL 8.3: != and <>
    • SQLite: != and <>
    • Oracle 10g: != and <>
    • Microsoft SQL Server 2000/2005/2008/2012/2016: != and <>
    • IBM Informix Dynamic Server 10: != and <>
    • InterBase/Firebird: != and <>
    • Apache Derby 10.6: != and <>
    • Sybase Adaptive Server Enterprise 11.0: != and <>

    Databases that support the ANSI standard operator, exclusively:

    • IBM DB2 UDB 9.5: <>
    • Microsoft Access 2010: <>

提交回复
热议问题