Skip to main contentSkip to solution

What will be output of the following SQL statement?

SELECT MID("CUETEXAM",2,5);

Solution

✅ Correct Option: 2

MID(string, position, length) starts at the given position, counting from 1, and returns that many characters.

Here it starts at position 2 and takes 5 characters.

CUETEXAM
12345678

Positions 2 to 6 give UETEX.


Option 4: this comes from counting positions from 0, as in Python. SQL counts from 1.

Options 1 and 3: these return only 4 characters, but the length given is 5.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question