93.9k views
1 vote
What does the following statement return? SELECT SUBSTRING('excellent', 3, 4).

a) 'ell'
b) 'cell'
c) 'elle'
d) 'exc'

1 Answer

3 votes

The following SQL statement returns:

a) 'ell'

How to explain

The function SUB STRING('excellent', 3, 4) extracts a substring starting from the third character ('e') and continues for a length of four characters.

The SQL SUB STRING function retrieves a portion of a string based on specified starting position and length. SELECT SUB STRING('excellent', 3, 4) returns 'ell' by extracting characters 3 to 6.

Therefore, it extracts characters from positions 3 to 6 in the string 'excellent', resulting in 'ell'.

User Orizon
by
7.0k points