Multiple choice

Which of the following SELECT statements will get the result 'ELCOME' from the string 'WELCOME'?

  1. SELECT SUBSTR ('WELCOME',1) FROM dual;

  2. SELECT INITCAP(TRIM('WELCOME', 1,1) FROM dual;

  3. SELECT LOWER (SUBSTR ('WELCOME', 2,1) FROM dual;

  4. SELECT LOWER (SUBSTR('WELCOME', 2,1) FROM dual;

  5. SELECT LOWER (TRIM ('W' FROM 'WELCOME')) FROM dual;

Reveal answer Fill a bubble to check yourself
E Correct answer
Explanation

TRIM with the 'W' FROM clause removes the leading 'W' character, leaving 'ELCOME'. The LOWER function then converts the remaining string to lowercase, producing 'elcome'. Option A uses SUBSTR incorrectly and doesn't achieve the transformation, options B and C have syntax errors in their function calls, and option D has incorrect syntax.