COUNTEQUAL
Descriptionβ
Determine the number of value elements in the array
Syntaxβ
COUNTEQUAL(<arr>, <value>)
Parametersβ
Parameter | Description |
---|---|
<arr> | Input arrayd |
<value> | Judging elements |
Return Valueβ
The returned judgment results are as follows: num: the number of value in array; 0: value does not exist in array arr; NULL: if the array is NULL.
Exampleβ
SELECT COUNTEQUAL(NULL,1),COUNTEQUAL([1, 2, 3, 'c'],2),COUNTEQUAL([],'b');
+---------------------+---------------------------------------------------+------------------------------------------+
| countequal(NULL, 1) | countequal(['1', '2', '3', 'c'], cast(2 as TEXT)) | countequal(cast([] as ARRAY<TEXT>), 'b') |
+---------------------+---------------------------------------------------+------------------------------------------+
| NULL | 1 | 0 |
+---------------------+---------------------------------------------------+------------------------------------------+