Examveda
Examveda

The string function that returns the index of the first occurrence of substring is . . . . . . . .

A. INSERT()

B. INSTR()

C. INSTRING()

D. INFSTR()

Answer: Option B

Solution(By Examveda Team)

INSTR(): The INSTR() function in MySQL is used to find the position of the first occurrence of a substring within a string. It returns the index (position) of the first character of the substring within the string. If the substring is not found, it returns 0. The syntax for the INSTR() function is INSTR(string, substring).
INSERT(): The INSERT() function is used to insert a substring into a string at a specified position. It is not used to find the position of a substring within a string.
INSTRING(): This option is incorrect. There is no function named INSTRING() in MySQL for finding the position of a substring within a string.
INFSTR(): This option is incorrect. There is no function named INFSTR() in MySQL for finding the position of a substring within a string.

Therefore, the string function that returns the index of the first occurrence of a substring is Option B: INSTR().

This Question Belongs to MySQL >> MySQL Miscellaneous

Join The Discussion

Related Questions on MySQL Miscellaneous