element_at
Syntax
Returns an element of an array located at the input position. If there is no element at the position, return NULL.
position
is 1-based and support negtive number.
positive position
example:
negtive example:
mysql> set enable_vectorized_engine=true;
mysql> SELECT id,c_array,c_array[-2] FROM `array_test`;
+------+-----------------+----------------------------------+
+------+-----------------+----------------------------------+
| 1 | [1, 2, 3, 4, 5] | 4 |
| 2 | [6, 7, 8] | 7 |
| 3 | [] | NULL |
+------+-----------------+----------------------------------+