Question:

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: Sep 18, 2025
  • NOOUTPUT
  • 5
  • 0
  • ERROR
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is D

Solution and Explanation

Step 1: Function understanding.
- MID(string, start, length) extracts a substring from \textit{string}, starting at \textit{start}, of size \textit{length}.
- LENGTH(string) gives the number of characters in the string.
Step 2: Problem in query.
Here: \texttt{MID('INFORMATICS PRACTICES', 5, -5)}. The third argument (length) cannot be negative in SQL. Hence, this query is invalid.
Step 3: Conclusion.
Instead of producing a substring, the database will throw an error.
Final Answer: \[ \boxed{\text{ERROR}} \]
Was this answer helpful?
0
0

Questions Asked in CUET exam

View More Questions