What does SQL Select symbol || mean?

后端 未结 6 2181
生来不讨喜
生来不讨喜 2020-12-03 04:26

What does || do in SQL?

SELECT \'a\' || \',\' || \'b\' AS letter
6条回答
  •  长情又很酷
    2020-12-03 05:14

    || represents string concatenation. Unfortunately, string concatenation is not completely portable across all sql dialects:

    • ansi sql: || (infix operator)
    • mysql: concat ( vararg function ). caution: || means 'logical or' (It's configurable, however; thanks to @hvd for pointing that out)
    • oracle: || (infix operator), concat ( caution: function of arity 2 only ! )
    • postgres: || (infix operator)
    • sql server: + (infix operator), concat ( vararg function )
    • sqlite: || (infix operator)

    hopefully the confusion is complete ...

提交回复
热议问题