Skip to main contentSkip to solution

What will be the output of the following query?

SELECT MID("NCERT DELHI", 2, 4);

Solution

✅ Correct Option: 1

MID(string, start, length) returns length characters from the string, starting at position start, where positions count from 1.

In "NCERT DELHI", position 1 is N, so position 2 is C. Taking 4 characters from there gives C, E, R, T, which is "CERT".


Option 3: NCER would come from starting at position 1, but SQL positions start at 1 for the first character, so a start of 2 skips the N.

Option 2: ERT is only 3 characters, but the length argument is 4.

Keyboard Shortcuts

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