String Operators

  • concept
    +

    N1QL provides the concatenation string operator.

    Concatenation

    The concatenation operator joins two strings. The result of the concatenation operator is also a string.

    Syntax

    concatenation-term ::= expr '||' expr
    Syntax diagram

    Example

    The following example shows concatenation of two strings.

    Query
    SELECT fname || " " || lname AS full_name
        FROM tutorial
    Result
     {
      "results": [
        {
          "full_name": "Dave Smith"
        },
        {
          "full_name": "Earl Johnson"
        },
        {
          "full_name": "Fred Jackson"
        },
        {
          "full_name": "Harry Jackson"
        },
        {
          "full_name": "Ian Taylor"
        },
        {
          "full_name": "Jane Edwards"
        }
      ]
    }

    Refer to Comparison Operators for string comparisons.