Watch the 7.3 Webinar On-Demand
This new release brings updates to Universal Storage, query optimization, and usability that you won’t want to miss.

FIELD

Returns the first index of the str argument in the str1, str2, … list, or 0 if it doesn’t exist.

Syntax

FIELD (str, str1, str2, ...)

Arguments

  • str: any string or binary object
  • str1, str2, … : list of strings or binary objects

Return Type

Integer

Example

SELECT FIELD('abra', 'cadabra', 'abra', 'abracadabra');
+-------------------------------------------------+
| FIELD('abra', 'cadabra', 'abra', 'abracadabra') |
+-------------------------------------------------+
|                                               2 |
+-------------------------------------------------+