Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Modify the query select \'John Smith\' from DUAL; . This time, use the SUBSTR fu

ID: 3937317 • Letter: M

Question

Modify the query select 'John Smith' from DUAL;. This time, use the SUBSTR function to extract a substring that represents your last name from the text string 'your_first_name your_last_name'. Assume you know the number of characters you need to extract.

Modify the query select 'John Smith' from DUAL; . This time, use the INSTR and SUBSTR functions to extract a substring that represents your first name from the text string 'your_first_name your_last_name'. Assume you do not know the number of characters to extract.

Modify the query select 'John Smith' from DUAL; . This time, use the INSTR, SUBSTR, and LENGTH functions to extract a substring that represents your last name from the text string 'your_first_name your_last_name'. Assume you do not know the number of characters you need to extract.

Explanation / Answer

1. SUBSTR function to extract the last name
   
select SUBSTR('John Smith', 6,10) from DUAL;

2. INSTR and SUBSTR functions to extact the first name

select SUBSTR('John Smith', 1,INSTR('John Smith', ' ',1,1)) from DUAL;

3.INSTR ,SUBSTR and LENGTH functions to extact the first name

select SUBSTR('John Smith',INSTR('John Smith', ' ',1,1),LENGTH('John Smith')) from DUAL;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote