数据仓库服务 GAUSSDB(DWS)-数组操作符:||

时间:2024-10-16 16:27:29

||

描述:数组与元素交叉组合进行连接,即数组与数组进行连接、元素与数组进行连接、数组与元素进行连接。

示例:

1
2
3
4
5
SELECT ARRAY[1,2,3] || ARRAY[4,5,6] AS RESULT;
    result     
---------------
 {1,2,3,4,5,6}
(1 row)
1
2
3
4
5
SELECT ARRAY[1,2,3] || ARRAY[[4,5,6],[7,8,9]] AS RESULT;
          result           
---------------------------
 {{1,2,3},{4,5,6},{7,8,9}}
(1 row)
1
2
3
4
5
SELECT 3 || ARRAY[4,5,6] AS RESULT;
  result   
-----------
 {3,4,5,6}
(1 row)
1
2
3
4
5
SELECT ARRAY[4,5,6] || 7 AS RESULT;
  result   
-----------
 {4,5,6,7}
(1 row)
support.huaweicloud.com/sqlreference-dws/dws_06_0332.html