What will be the output of the following query?select INSTR('Tech on the net', 'e', 1, 3) from dual;21114
Question
What will be the output of the following query?select INSTR('Tech on the net', 'e', 1, 3) from dual;21114
Solution
The output of the query will be 11.
Here's the step by step explanation:
-
The INSTR function in SQL is used to find the position of a substring in a string.
-
The syntax of the INSTR function is: INSTR(string, substring, start_position, nth_occurrence)
-
In your query, the string is 'Tech on the net', the substring is 'e', the start_position is 1 (which means start from the beginning of the string), and the nth_occurrence is 3 (which means find the position of the 3rd occurrence of 'e').
-
The first 'e' is found at position 2, the second 'e' is found at position 5, and the third 'e' is found at position 11.
-
Therefore, the output of the query is 11.
Similar Questions
The SQL statementSELECT SUBSTR(‘123456789’, INSTR(‘abcabcabc’,’c’), 9) FROM EMP; prints
In the following query, what will be retrieved from the database?SELECT *FROM facility AWHERE specialist = 'engineering'
If in Table “employee”, a column “emp_id” consists of {1,2,2,2,3,3,5,6,7,8,8} then what will be the output on executing the following query?SELECT DISTINICT emp_idFROM employee;[1,2,2,3,3,5,6,7,8,8][1,2,3,5,6,7,8][1,2,2,3,5,6,7,8]None of the mentionedReview AnswerNext
1. What is the SQL to do this result?
4. What is the SQL to do this result?
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.