Skip to main contentSkip to solution

What will be the output of the following SQL query?

SELECT INSTR(“Systematic”, “ma”)

Solution

✅ Correct Option: 2

INSTR(str, substr) returns the position of the first occurrence of substr in str, counting from 1.

In "Systematic", S is 1, y is 2, s is 3, t is 4, e is 5, m is 6 and a is 7. "ma" therefore starts at position 6.


Option 1: this is the position you would get by counting from 0, but SQL string positions start at 1.

Option 3: this is the position of "a", the end of the match, not its start.

Keyboard Shortcuts

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