Which of the following SQL statements will update columns C1 to DB2 and C2 to 11 if C3 is 2016?
Which of the following SQL statements will update columns C1 to DB2 and C2 to 11 if C3 is 2016?
The correct SQL statement to update columns C1 to 'DB2' and C2 to 11 if C3 is 2016 is: UPDATE t1 SET c1 = 'DB2', c2 = 11 WHERE c3 = 2016. This syntax ensures that we specify the table to update, assign the new values to the appropriate columns, and restrict the update to only the rows where C3 is 2016. Options A and B are incorrect because they lack the correct SET syntax and WHERE clause. Option D is incorrect because the use of parentheses in the SET clause is not appropriate, and it contains a misplaced '=' character.
Answer C is syntaxically wrong. The correct answer is D.
it is but has two typos, correct line is: UPDATE t1 SET (c1, c2) = ('DB2', 11) WHERE c3 = 2016
Correct answer is no one, the best is D as there is typo error on that. [db2inst2@vbox1 ~]$ db2 "UPDATE t1 SET (c1, c2) = ('~DB2', 11) = WHERE c3 = 2016" DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0104N An unexpected token "c3" was found following "('~DB2', 11) = WHERE". Expected tokens may include: "<space>". SQLSTATE=42601 [db2inst2@vbox1 ~]$ db2 "UPDATE t1 SET (c1, c2) = ('~DB2', 11) WHERE c3 = 2016" DB20000I The SQL command completed successfully.