Which statement is true regarding the execution of the …

View the exhibit and examine the description for the SALES and CHANNELS tables.

You issued the following SQL statement to insert a row in the SALES table:
INSERT INTO sales VALUES
(23, 2300, SYSDATE, (SELECT channel_id
FROM channels
WHERE channel_desc=’Direct Sales’), 12, 1, 500);
Which statement is true regarding the execution of the above statement?

View the exhibit and examine the description for the SALES and CHANNELS tables.

You issued the following SQL statement to insert a row in the SALES table:
INSERT INTO sales VALUES
(23, 2300, SYSDATE, (SELECT channel_id
FROM channels
WHERE channel_desc=’Direct Sales’), 12, 1, 500);
Which statement is true regarding the execution of the above statement?

A.
The statement will execute and the new row will be inserted in the SALES table.

B.
The statement will fail because subquery cannot be used in the VALUES clause.

C.
The statement will fail because the VALUES clause is not required with subquery.

D.
The statement will fail because subquery in the VALUES clause is not enclosed with in single quotation
marks.



Leave a Reply 4

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


Max

Max

The question is not clear:

For me the answer is B

1. The number of the columns into the INSERT statement is greater than the number of column accepted from the table SALES;
2. You cannot use the subquery when you are using the “VALUES” statement
3. The subquery queries channel_desc, wich is not clear if return one or more values.

Tim

Tim

not clear indeed.

I would assumed the picture is wrong (missing a column) and go with A.

1. number of columns in the insert and the table is indeed different and would cause an error
2. subquery does work when using values (at least when I tested it in 12.1) … B,C false
3. if the sub query does indeed return more than 1 row it would cause an error
4. single quotes are not required

evilsoldier

evilsoldier

It will execute sucessfully only if the subquery returns only one row.