State the output of the following SQL command.
SELECT MID('COMPUTER SCIENCE',-4);
State the output of the following SQL command.
SELECT MID('COMPUTER SCIENCE',-4);
Solution
NTA's key takes "NO OUTPUT", treating as needing all three arguments (the string, the starting position and the number of characters), while only two are given here.
We believe the answer should be Option 1, since NCERT's own table of string functions says that if is not specified, MID returns the substring from position till the end of the string, and in MySQL a negative position counts from the end, so MID('COMPUTER SCIENCE',-4) returns ENCE. However, NTA's final answer key (after all challenges) says Option 2.
Related questions:
2025: 30 May Shift 2
2026: 29 May Shift 1
2025: 30 May Shift 2
2026: 23 May Shift 2
2025: 21 May Shift 1