The EMPLOYEES table contains these columns:
EMPLOYEE_ID NUMBER(4)
LAST_NAME VARCHAR2 (25)
JOB_ID VARCHAR2(10)
You want to search for strings that contain ‘SA_’ in the JOB_ID column.
Which SQL statement do you use?
A.
SELECT employee_id, last_name, job_id FROM employees
WHERE job_id LIKE ‘%SA\\_’ ESCAPE ‘\\’;
B.
SELECT employee_id, last_name, job_id FROM employees
WHERE job_id LIKE ‘%SA_’;
C.
SELECT employee_id, last_name, job_id FROM employees
WHERE job_id LIKE ‘%SA_’ ESCAPE “\\”;
D.
SELECT employee_id, last_name, job_id FROM employees
WHERE job_id = ‘%SA_’;
Explanation:
ESCAPE identifier to search for the _ symbol
Incorrect answer:
BESCAPE identifier must be use
Cwrong syntax
Dwrong syntax
A has a typing error. Correct would be a unique ‘\’.
escape character must be character string of length 1
I think something is missing in A or in B.
The answer A would be correct like this:
SELECT employee_id, last_name, job_id FROM hr.employees
WHERE job_id LIKE ‘%SA\_%’ ESCAPE ‘\’;
or like this:
SELECT employee_id, last_name, job_id FROM hr.employees
WHERE job_id LIKE ‘%SA_%’ ESCAPE ‘\’;
The answer B would be correct like this:
SELECT employee_id, last_name, job_id FROM hr.employees
WHERE job_id LIKE ‘%SA_%’;