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?

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 13

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


himani

himani

INSERT STATEMENT INSERTS 7 VALUES AND THE TABLE ONLY HAVE 6 COLUMNS SO HOW THE FIRST OPTION IS CORRECT

steven

steven

It’s crazy

Justyna

Justyna

It looks like it is mistake in the statement. It should be one number less but you can use subquery in the caluse Values like in the above example.

kar

kar

B,C,D are wrong so A is correct but printing mismake(one extra number)
So ‘A’ is correct

user

user

If the subquery would return 2 or more ID’s how is A corect?

dethleffs

dethleffs

“single-row subquery returns more than one row”

Prince Jain

Prince Jain

Sub query is returning Channel ID which is PK. It means returning only one row(value)

Sayed

Sayed

Simply, the questions has asked that sub-query is acceptable in INSERT column VALUES. So, answer ‘A’ is correct. Assume table sales has 7 column and sub-query will give one singe value.

Hossam

Hossam

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

Alexandre

Alexandre

This question has apparently two errors: First, as mentinoned before, the theoretical correct answer has 7 attributes values and the table SALES has 6; second, there is a possibility in which this subquery to return more than 1 result. This question must be reviewed.

helpful hints

helpful hints

Thanks , I’ve recently been looking for info approximately this topic for a while and yours is the best I’ve found out so far. However, what about the conclusion? Are you sure about the source?|

Monique

Monique

cheap team soccer jerseys knock off hockey jerseys

JULIOHHHH

JULIOHHHH

Ninguna es la respuesta correcta, porque se trata de insertar en una tabla con 6 columnas, 7 valores. Esas pruebas están muy mal hechas.