Question:medium

State the output of the following query: \[ \text{SELECT LENGTH(MID('INFORMATICS PRACTICES',5,-5));} \]

Show Hint

MID/ SUBSTR functions require a positive length. Negative values are not valid and cause errors.
Updated On: Feb 15, 2026
  • NOOUTPUT
  • 5
  • 0
  • ERROR
Show Solution

The Correct Option is D

Solution and Explanation

Step 1: Function understanding.
- MID(string, start, length) extracts a substring from \textit{string}, beginning at \textit{start}, with a length of \textit{length}.
- LENGTH(string) returns the character count of the string.
Step 2: Query Issue.
In this query: \texttt{MID('INFORMATICS PRACTICES', 5, -5)}. The length argument in SQL cannot be negative. Therefore, this query is invalid.
Step 3: Outcome.
Instead of generating a substring, the database will produce an error.
Final Answer: \[\boxed{\text{ERROR}}\]
Was this answer helpful?
0