Informatics Practices
What will be returned by the given query ?
SELECT INSTR("INDIA", "DI");
- 2
- 3
- -2
- -3
SQL Queries
1 Like
Answer
3
Reason — The INSTR()
function in MySQL returns the position of the first occurrence of a substring within a string. The position of "DI" within "INDIA" is at the third position in the string "INDIA". Therefore, the INSTR()
function will return 3.
Answered By
1 Like
Related Questions
Which of the following is not a valid aggregate function in MYSQL ?
- COUNT()
- SUM()
- MAX()
- LEN()
What will be printed by the given query ?
SELECT LENGTH("WINNER");
- 7
- 6
- 8
- 9
If the substring is not present in a string, the INSTR() returns:
- -1
- 1
- NULL
- 0
What will be returned by the given query ?
SELECT concat("It", "was", "ok");
- "It was ok"
- "It wasok"
- "Itwasok"
- "Itwas ok"