Which SQL statement do you use?

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?

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 = ‘%SA_’;

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 LIKE ‘%SA\_%’ ESCAPE ‘\’;

Explanation:

ESCAPE identifier to search for the actual % and _ symbol
Refer : Introduction to Oracle9i : SQL, Oracle University Study Guide, 2-13



Leave a Reply 7

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


zeeshan911

zeeshan911

Ans =d

aryan

aryan

WHAT ABOUT B

ANIKET

ANIKET

Ans = d to fetch data with special char. we have to use wildcards

jack

jack

The right choice is D.

sthaporn suksanga

sthaporn suksanga

B