

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Which MySQL functions work as similar as LOCATE() function?
MySQL INSTR() and POSITION() function works similar as LOCATE() function. They both are synonyms of LOCATE() function.
INSTR() function also returns the position of the first occurrence of the substring after searching from the string. The syntax of INSTR() is as follows −
Syntax of INSTR()
INSTR(string, substring)
Here, String is the string from which MySQL will search and substring is the string which is to be searched.
Example
mysql> Select INSTR('Ram is a good boy', 'good')As Result; +--------+ | Result | +--------+ | 10 | +--------+ 1 row in set (0.00 sec)
POSITION() function also returns the position of the first occurrence of the substring after searching from the string. Syntax of POSITION() is as follows −
Syntax of POSITION()
INSTR(substring IN string)
Here, String is the string from which MySQL will search.
Substring is the string which is to be searched.
‘IN’ is a keyword.
Example
mysql> Select POSITION('good' in 'Ram is a good boy')As Result; +--------+ | Result | +--------+ | 10 | +--------+ 1 row in set (0.00 sec)
- Related Questions & Answers
- When MySQL LOCATE() function returns NULL as the output?
- Which function in MySQL returns the same output as BIN() function?
- What happens if I will use integer values as arguments of MySQL LOCATE() function?
- How MySQL LOCATE() function is different from its synonym functions i.e. POSITION() and INSTR() functions?
- Python Standard operators as functions
- Which MySQL function returns a specified number of characters of a string as output?
- When MySQL FIND_IN_SET() function returns NULL as output?
- What is the difference between MySQL LOCATE() and FIND_IN_SET() functions?
- MySQL CAST as DATE?
- What is the use of LOCATE() function in MySQL?
- Which great rulers were known as great strategists?
- What MySQL returns if we use NULL, as both the arguments, as one of the argument and as a separator, in CONCAT_WS() function?
- Can Python functions run in html as javascript does?
- Which punctuation character can be used as the delimiter between MySQL date parts?
- Which punctuation character can be used as the delimiter between MySQL time parts?
Advertisements