What MySQL returns if the search string, provided in FIELD() function, is NULL?


As we know that NULL fails equality comparison with any value hence if the search string, provided in FIELD() function, is NULL then MySQL returns 0 as output.

Example

mysql> Select FIELD(NULL,'Ram','is','good','boy');

+-------------------------------------+
| FIELD(NULL,'Ram','is','good','boy') |
+-------------------------------------+
|                                   0 |
+-------------------------------------+

1 row in set (0.00 sec)

Vikyath Ram
Vikyath Ram

A born rival

Updated on: 20-Jun-2020

64 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements