- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
In MySQL, which function we can use to find the index position of a particular string from a list of strings?
We can use FIELD() function to find the index position of a particular string from a list of strings.
Syntax
FIELD(str search,String1, String2,…StringN)
Here, the str search is the string whose index number we want to search and String1, String …StringN is the list of strings from which the search would happen.
Example
mysql> Select FIELD('good', 'Ram', 'is', 'a', 'good', 'boy')AS 'Index Number of good'; +----------------------+ | Index Number of good | +----------------------+ | 4 | +----------------------+ 1 row in set (0.00 sec)
Advertisements