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?
A.
INSERT INTO t1 VALUES (100)
B.
INSERT INTO t1 (c1, c2) VALUES (100)
C.
INSERT INTO t1 (c1, c3) VALUES ("˜100', "˜100.00')
D.
INSERT INTO t1 (c2, c3) VALUES (100, 100.00), (101, 101)
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.
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
upvoted 3 times
...
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
JamesBond
3 years, 4 months agomperedithe18
4 years, 1 month agoKalliopi
4 years, 2 months agodeepdg23
4 years, 4 months agodb2tester
5 years, 1 month ago