KnowledgeBoat Logo

Informatics Practices

What will be returned by the given query ?

SELECT INSTR("INDIA", "DI");
  1. 2
  2. 3
  3. -2
  4. -3

SQL Queries

1 Like

Answer

3

Reason — The INSTR() function in MySQL returns the position of the first occurrence of a substring within a string. The position of "DI" within "INDIA" is at the third position in the string "INDIA". Therefore, the INSTR() function will return 3.

Answered By

3 Likes


Related Questions