What is output of the following SQL statement?
LENGTH(MID("COMPUTER",3,5));
What is output of the following SQL statement?
LENGTH(MID("COMPUTER",3,5));
Solution
✅ Correct Option: 2
MID(str, pos, n) returns n characters starting at position pos, so MID("COMPUTER",3,5) starts at the 3rd character (M) and takes 5 characters, giving "MPUTE".
LENGTH("MPUTE") counts the characters, which is 5.
Option 3: 8 is the length of the whole string "COMPUTER", but MID extracts only part of it first.
Option 1: 3 is the starting position, not the length of the result.
Related questions:
2026: 23 May Shift 1
2026: 26 May Shift 1
2025: 30 May Shift 2
2026: 13 May Shift 2