Home » Oracle » 1z0-061 » Which WHERE clause could be used in the SELECT statement to get the required output?
You need to extract details of those products in the SALES table where the PROD_ID column contains the string ‘_D123’. Which WHERE clause could be used in the SELECT statement to get the required output?
A. WHERE prod_id LIKE ‘%_D123%’ ESCAPE ‘_’
B. WHERE prod_id LIKE ‘%_D123%’ ESCAPE ”
C. WHERE prod_id LIKE ‘%_D123%’ ESCAPE ‘%_’
D. WHERE prod_id LIKE ‘%_D123%’ ESCAPE ‘_’
Correct Answer: B
Explanation/Reference:
Explanation:
A naturally occurring underscore character may be escaped (or treated as a regular nonspecial symbol) using the ESCAPE identifier in conjunction with an ESCAPE character. The second example in Figure 3-12 shows the SQL statement that retrieves the JOBS table records with JOB_ID values equal to SA_MAN and SA_REP and which conforms to the original requirement:
select job_id from jobs
where job_id like ‘SA_%’ escape ”;
Download Printable PDF. VALID exam to help you PASS.
|
|
The choices are clear here: https://www.briefmenow.org/oracle/which-where-clause-could-be-used-in-the-select-statement-to-get-the-required-output/
Wrong. The answer should be AD
A is incorrect. In order to use ESCAPE ‘_’ sequence you must have changed your query to WHERE prod_id LIKE ‘%__D123%’ ESCAPE ‘_’
B is incorrect, it will return error
C is incorrect, it will return error.
D is incorrect, it is a duplicate for A