Skip to main contentSkip to solution

What will be the output of the below query?

SELECT MID("Practices", 2, 3);

Solution

✅ Correct Option: 2

MID(str, pos, len) returns lenlen characters from the string, starting at position pospos, where counting starts at 1.

In "Practices", the positions are P = 1, r = 2, a = 3, c = 4. Starting at position 2 and taking 3 characters gives "rac".


Option 1: "act" would be the result for MID("Practices", 3, 3), i.e. starting at position 3, which happens if you treat the position as starting from 0.

Options 3 and 4: these have only 2 characters, but the length given is 3.

Keyboard Shortcuts

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