Multiple choice technology databases

Want to search character 'a' from last in the string 'Hi Partha Sarathi Ojha'. So what would be the query...

  1. select instr('Hi Partha Sarathi Ojha',last,'a') from dual

  2. select instr('Hi Partha Sarathi Ojha','a',-1) from dual

  3. select instr('Hi Partha Sarathi Ojha',left,'a') from dual

  4. select instr('Hi Partha Sarathi Ojha',-1,'a') from dual

  5. select instr('Hi Partha Sarathi Ojha','-a') from dual

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

INSTR with a negative start position (third parameter) searches backwards from the end of the string. Setting start to -1 means start searching from the last character. This finds the last occurrence of 'a' in the string.