Which WHERE clause could be used in the SELECT statemen…

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?

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 ‘\\_’

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 ‘\\’;



Leave a Reply 0

Your email address will not be published. Required fields are marked *