array_position

    Syntax

    返回value在数组中第一次出现的位置/索引。

    1. mysql> set enable_vectorized_engine=true;
    2. +------+-----------------+------------------------------+
    3. +------+-----------------+------------------------------+
    4. | 1 | [1, 2, 3, 4, 5] | 5 |
    5. | 2 | [6, 7, 8] | 0 |
    6. | 3 | [] | 0 |
    7. | 4 | NULL | NULL |
    8. mysql> select array_position([1, null], null);
    9. +--------------------------------------+
    10. | array_position(ARRAY(1, NULL), NULL) |
    11. +--------------------------------------+
    12. | 2 |
    13. +--------------------------------------+

    ARRAY,POSITION,ARRAY_POSITION