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

Third Query Formatting Help Please explain the purpose of the formatting techniq

ID: 3732066 • Letter: T

Question

Third Query Formatting Help

Please explain the purpose of the formatting technique or the purpose of the function for each of the queries in the image below.

Query 10 ' SELECT INSTR ('MARION SMITH', ') FROM DUAL; -Query 11 SELECT CONCAT (CONCAT ('SMITH, ', 'MARION) FROM DUAL Query 12 SELECT CONCAT ( (SUBSTR ('MARION SMITH', INSTR ('MARION SMITH', +1)),',' AS LASTNAME FROM DUAL; -Query 13 (SUBSTR ('MARION SMITH'' 1, INSTR ('MARION SMITH', ' SELECT '))) AS FIRSTNAME FROM DUAL; -Query 14 SELECT CONCAT (CONCAT (SUBSTR ( 'MARION SMITH ' , INSTR ( 'MARION SMITH ' ' ' ' ) +1 ) ) , , , , ) , SUBSTR 'MARION SMITH', 1, INSTR ('MARION SMITH,')))AS LastNameFollowedByFirstNam RO DUAL:

Explanation / Answer

SELECT INSTR('MARION SMIIH', ' ') FROM DUAL;
--Search for " " space position in string 'MARION SMIIH', and return position:
-- Result will be 7

SELECT CONCAT(CONCAT('SMITH',', ' ),'MARION')
--The CONCAT() function concatenates two or more expressions together.
--IN this query first SMITH will be concatenated by , (comma) and space after that MARION
--so output will be 'SMITH, MARION'

SELECT (SUBSTR ('MARION SMIIH', 1,INSTR('MARION SMIIH', ' '))) AS FIRSTNAME
--The SUBSTRING() function extracts a substring from a string.
--i.e instr will give the position of space pf the string 'MARION SMIIH' means 7 that will be considered is 2nd parameter of substr
--function i.e starting position is 1 and end position is 7 so output will be MARION

Query 14 - it is also the same as above in this substring position will be 7+1 i.e smith ( as last name prefix with space )
and take the first name as above and concatenate the same to result the last name followed by the first name a

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