arrays_overlap

功能

对于两个同类型数组,返回1代表存在交集,返回0代表不存在交集。

语法

output arrays_overlap(input0, input1)

参数说明

  • input0:数组。
  • input1: 与input0类型一致的数组。

返回值说明

类型为BOOLEAN, 1代表存在交集,0代表不存在。

示例

示例一:

mysql> select arrays_overlap([11, 9, 3, 2], [null, 11]);
+--------------------------------------+
| arrays_overlap([11,9,3,2], [NULL,11]) |
+--------------------------------------+
|                                    1 |
+--------------------------------------+

示例二:

mysql> select arrays_overlap([9, 3, 2], [null, 11]);
+-----------------------------------+
| arrays_overlap([9,3,2], [NULL,11]) |
+-----------------------------------+
|                                 0 |
+-----------------------------------+

示例 三:

mysql> select arrays_overlap([9, 3, null, 2], [null, 11]);
+----------------------------------------+
| arrays_overlap([9,3,NULL,2], [NULL,11]) |
+----------------------------------------+
|                                      1 |
+----------------------------------------+

示例 四:

mysql> select arrays_overlap([9, 3, "SQL", 2], [null, "SQL"]);
+--------------------------------------------+
| arrays_overlap([9,3,'SQL',2], [NULL,'SQL']) |
+--------------------------------------------+
|                                          1 |
+--------------------------------------------+

关键字

ARRAYS_OVERLAP