What is the difference between != and <> operators?

后端 未结 4 391
旧巷少年郎
旧巷少年郎 2021-01-17 11:09

I don\'t like not knowing this as there may be situations when I need to use one instead of the other. It seems in most cases they produce the same results but I am taking a

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-17 11:35

    <> is the standard SQL operator meaning "not equal". Many databases, including postgresql, supports != as a synonym for <>.

    They're exactly the same in postgresql. See also the documentation.

    Note though, that postgresql allows you to implement your own types and overload operators for those types, so ultimately it depends on the datatypes involved what the != and <> operator actually does, but <> and != can never do different things.

提交回复
热议问题