Skip to main contentSkip to solution

What will be the output of the following SQL query?

SELECT MID(“Electronics”, 7);

Solution

✅ Correct Option: 3

MID(str, pos) returns the substring starting at position pos and continuing to the end of the string when no length is given. Counting from 1 in "Electronics", position 7 is the letter "o".

Electronics
1234567891011

Everything from position 7 onwards is "onics".


Option 1: "Electro" is the first 7 characters, which is what LEFT("Electronics", 7) gives. 7 in MID is a starting position, not a length.

Option 2: "lectron" would need a start position and length, MID("Electronics", 2, 7).

Option 4: "tics" is the last 4 characters, which is what RIGHT("Electronics", 4) gives.

SQL string positions start at 1, not 0.

Keyboard Shortcuts

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