bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/SQL/SQL References
SQL•SQL References

MySQL FIELD() Function

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind MySQL FIELD() Function?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___ FIELD("q", "s", "q", "l");
3Order

Put the learning moves in the order that makes the concept easiest to apply.

The FIELD() function returns the index position of a value in a list of values.
Definition and Usage
MySQL FIELD() Function

Example

SELECT FIELD("q", "s", "q", "l");

Definition and Usage

The FIELD() function returns the index position of a value in a list of values.

This function performs a case-insensitive search.

Note

If the specified value is not found in the list of values, this function will return 0. If value is NULL, this function will return 0.

Syntax

FIELD(
value
,
val1
,
val2
,
val3
, ...)

Parameter Values

ParameterDescription
valueRequired. The value to search for in the list
val1 , val2 , val3 , ....Required. The list of values to search

Technical Details

Works in:From MySQL 4.0

Previous

MySQL CONCAT_WS() Function

Next

MySQL FIND_IN_SET() Function