Which of the following functions will perform the same task?
A. MID(string, pos, n)
B. SUB(string, pos, n)
C. SUBSTRING(string, pos, n)
D. SUBSTR(string, pos, n)
Which of the following functions will perform the same task?
A. MID(string, pos, n)
B. SUB(string, pos, n)
C. SUBSTRING(string, pos, n)
D. SUBSTR(string, pos, n)
Solution
✅ Correct Option: 2
MID(), SUBSTRING() and SUBSTR() are synonyms in MySQL. Each returns characters of the string starting from position pos.
For example, , and all return PUT.
B (SUB): there is no SQL string function named SUB, so it cannot perform this task. This is why Options 1, 3 and 4 are wrong.
Related questions:
2025: 13 May Shift 2
2025: 13 May Shift 2
2025: 13 May Shift 2
2026: 18 May Shift 2
2026: 23 May Shift 2