Exam 1z0-082 All QuestionsBrowse all questions from this exam
Question 100

Examine the description of the PRODUCT_STATUS table:

The STATUS column contains the values 'IN STOCK' or 'OUT OF STOCK' for each row.

Which two queries will execute successfully? (Choose two.)

    Correct Answer: D, F

    The two queries that will execute successfully are D and F. Option D correctly concatenates the prod_id with the string literal using the Oracle-specific quoting mechanism q'(...)' and does not cause any syntax errors. Option F does the same but also provides an alias for the result column, which is syntactically correct. Other options either have incorrect aliasing, improper termination of quoted strings, or invalid use of identifiers.

Discussion
canijhoOptions: DF

A - Bad alias, ORA-00923: FROM keyword not found where expected B - Bad syntax, ORA-01756: quoted string not properly terminated C - Bad alias, ORA-00923: FROM keyword not found where expected D --OK E - Bad syntax, ORA-00904: "Q": invalid identifier F --OK

BeomKOptions: DF

D,F is correct

auwiaOptions: DF

D and F are correct.

it6567306Options: AD

Two options, A and D, are successful. The table definition creation SQL and data registration SQL required to execute the SQL listed in the question text options are shown below.

it6567306

CREATE TABLE product_status ( prod_id NUMBER(2) NOT NULL, status VARCHAR2(15) NOT NULL ); INSERT INTO product_status (prod_id, status) VALUES (1, 'IN STOCK'); INSERT INTO product_status (prod_id, status) VALUES (2, 'OUT OF STOCK'); INSERT INTO product_status (prod_id, status) VALUES (3, 'IN STOCK'); INSERT INTO product_status (prod_id, status) VALUES (4, 'OUT OF STOCK'); --Oracle Live SQL

it6567306

A. select prod_id "CURRENT AVAILABILITY" || q'('s not available)' from product_status where status = 'OUT OF STOCK'; B. select prod_id || q'('s not available" from product_status where status = OUT OF STOCK'; C. select prod_id || q'('s not available)' 'CURRENT AVAILABILITY' FROM product_status where status = 'OUT OF STOCK'; D. select prod_id || q'('s not available)' from product_status where status = 'OUT OF STOCK'; E. select prod_id || q"'s not available" from product_status where status = 'OUT OF STOCK'; F. select prod_id || q'('s not available)' "CURRENT AVAILABILITY" FROM product_status where status = 'OUT OF STOCK';

it6567306

A - ORA-00923: FROM keyword not found where expecte B - ORA-01756: quoted string not properly terminated C - ORA-00923: FROM keyword not found where expected D--OK E - ORA-00904: "Q": invalid identifier F--OK