nerdexam
Oracle

1Z0-061 · Question #199

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…

The correct answer is B. WHERE prod_id LIKE '%\_D123%' ESCAPE '\'. 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…

Restricting and Sorting Data

Question

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?

Options

  • AWHERE prod_id LIKE '%D123%' ESCAPE ''
  • BWHERE prod_id LIKE '%_D123%' ESCAPE ''
  • CWHERE prod_id LIKE '%D123%' ESCAPE '%'
  • DWHERE prod_id LIKE '%_D123%' ESCAPE '_'

How the community answered

(19 responses)
  • A
    11% (2)
  • B
    84% (16)
  • D
    5% (1)

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 '';

Topics

#LIKE operator#ESCAPE clause#wildcard characters#pattern matching

Community Discussion

No community discussion yet for this question.

Full 1Z0-061 Practice