Question:

What is the output of the SQL statement?
SELECT MID('CUET2024',2,5)?

Updated On: Mar 29, 2025
  • UET2
  • ET202
  • UET20
  • CUET2
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is C

Solution and Explanation

SQL Function Analysis: The MID() function extracts a substring from a string. The syntax is MID(string, start_position, length).

Breaking down the query: MID('CUET2024', 2, 5)

  • String: 'CUET2024' (positions: 1=C, 2=U, 3=E, 4=T, 5=2, 6=0, 7=2, 8=4)
  • Start at position: 2 (the 'U')
  • Extract 5 characters: From position 2 through 6 (U,E,T,2,0)

Evaluating the options:

(1) UET2 → Incorrect (only 4 characters)

(2) UET20 → Correct (positions 2-6: U,E,T,2,0)

(3) ET202 → Incorrect (starts at position 3 instead of 2)

(4) CUET2 → Incorrect (starts at position 1 instead of 2)

Character Position Mapping:

C U E T 2 0 2 4 1 2 3 4 5 6 7 8

The correct output is (3) UET20, as it correctly extracts 5 characters starting from position 2.

Was this answer helpful?
0
0