Exam C2090-616 All QuestionsBrowse all questions from this exam
Question 45

The DDL statement is used to create table T1:

CREATE TABLEt1 (

c1 INTEGER,

c2 INTEGER NOT NULL,

c1 DECIMAL(11,2),

c4 TIMESTAMP WITH DEFAULT CURRENT TIMESTAMP

)

Which of the following INSERT statements will execute successfully?

    Correct Answer: D

    The statement INSERT INTO t1 (c2, c3) VALUES (100, 100.00), (101, 101) will execute successfully. The table T1 has four columns: c1 (INTEGER), c2 (INTEGER NOT NULL), c3 (DECIMAL(11,2)) and c4 (TIMESTAMP WITH DEFAULT CURRENT TIMESTAMP). Option D correctly specifies values for c2 and c3. Despite the default value for c4, it need not be explicitly mentioned as it is automatically set. The missing c1 will be inserted as NULL, which is allowed. Option A is incorrect as it does not provide values for all columns. Option B and C fail because they do not respect the NOT NULL constraint for c2 and because they don't match all necessary columns.

Discussion
db2testerOption: D

The good answer is "D- INSERT INTO t1 (c2, c3) VALUES (100, 100.00), (101, 101) " C2 column has the constraint not null. The answer ""INSERT INTO t1(c1,c2) VALUES(100)" is not good because you have to insert two values. You will get the error SQL0117N The number of values assigned is not the same as the number of specified or implied columns or variables. SQLSTATE=42802

mperedithe18Option: D

D is the correct answer. Option B is not correct. It will fail because the number of values do not match the number of columns called out in the statement.

KalliopiOption: D

D is the good one

deepdg23Option: D

D is the best option

JamesBondOption: D

D is correct [db2inst2@vbox1 ~]$ db2 "INSERT INTO t1 (c2, c3) VALUES (100, 100.00), (101, 101)" DB20000I The SQL command completed successfully. [db2inst2@vbox1 ~]$