Complete the code to find the position of 'cat' in the string 'concatenate'.
SELECT [1]('cat', 'concatenate');
The LOCATE function returns the position of the first occurrence of a substring in a string in MySQL.
Complete the code to find the position of 'dog' in the string 'hotdogstand'.
SELECT [1]('dog', 'hotdogstand');
LOCATE returns the position of the substring 'dog' in 'hotdogstand'.
Fix the error in the code to correctly find the position of 'sun' in 'sunshine'.
SELECT INSTR('sunshine', [1]);
The substring must be a string literal, so it needs quotes: 'sun'.
Fill both blanks to find the position of 'day' in 'holiday' starting from position 3.
SELECT LOCATE([1], [2], 3);
LOCATE takes substring, string, and start position. Here, substring is 'day' and string is 'holiday'.
Fill all three blanks to find the position of 'test' in 'this is a test string' starting from position 11.
SELECT LOCATE([1], [2], [3]);
LOCATE finds the substring 'test' in the string 'this is a test string' starting at position 11.