What does SQL Select symbol || mean?

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

What does || do in SQL?

SELECT \'a\' || \',\' || \'b\' AS letter
相关标签:
6条回答
  • 2020-12-03 04:48

    It's a concatenation operator. So you would get 'a,b' from that. I think || will work on most RDBMS's. SQL Server requires the + operator (thanks to HVD for setting me straight!).

    0 讨论(0)
  • 2020-12-03 05:02

    SELECT 'a' || ',' || 'b' AS letter will combine a letter. The result become 'a,b'

    0 讨论(0)
  • 2020-12-03 05:05

    In Oracle, SQLite3, and MySQL, it concatenates strings. Please see the Oracle documentation. The MySQL documentation.

    Also, it's part of ANSI SQL, but read this for more information.

    0 讨论(0)
  • 2020-12-03 05:10

    in oracle its a shortcut for concatenate

    http://docs.oracle.com/cd/B19306_01/server.102/b14200/operators003.htm

    0 讨论(0)
  • 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 ...

    0 讨论(0)
  • 2020-12-03 05:14

    It is a concat statement. It will concatenate the two strings.

    Here is a helpful post!

    What is the difference between "||" operator and concat function in Oracle?

    0 讨论(0)
提交回复
热议问题