Question:medium

State whether the following statement is True or False:

The INSTR(stringl, string2) function in SQL returns 0 if string2 is not present as a substring in string1.

Show Hint

INSTR() gives the position of the substring, and it gives 0 when the substring is not found.
Updated On: Oct 20, 2026
  • True
  • False
  • Cannot be determined
  • None of the above
Show Solution

The Correct Option is A

Solution and Explanation

Step 1: Read the claim carefully:
The claim is: INSTR(string1, string2) gives 0 when string2 is not inside string1.
We only need to check what INSTR returns for a missing substring.

Step 2: Run two small queries in your head:
SELECT INSTR('Delhi', 'hi'); gives 4, since 'hi' begins at the 4th character.
SELECT INSTR('Delhi', 'z'); gives 0, since there is no 'z' in 'Delhi'.

Step 3: State the rule:
A position count starts at 1 in SQL strings. So 0 is kept as the sign for 'not found'. This is a fixed rule and does not change with the data.

Step 4: Compare with the options:
The claim matches the rule, so it is True.
'Cannot be determined' is wrong because the result is always known. 'None of the above' is wrong because True is listed.

Final Answer:
The statement is True. The answer is option (A).
Was this answer helpful?
0

Top Questions on Text Date and Math Functions in MySQL