IBM DB2 11.1 Advanced DBA for Linux, UNIX, and Windows — Question 22
Which of the following SQL statements will update columns C1 to DB2 and C2 to 11 if C3 is 2016?
Answer options
- A. UPDATE t1 c1 = "˜DB2, c2' = 11
- B. UPDATE t1 SET c1 = "˜DB2, c2' = 11
- C. UPDATE t1 c1 = "˜DB2', c2 = 11 WHERE c3 = 2016
- D. UPDATE t1 SET (c1, c2) = ("˜DB2', 11) = WHERE c3 = 2016
Correct answer: C
Explanation
The correct answer, C, properly uses the SQL syntax to update the specified columns with a WHERE clause to filter by C3. Options A and B are incorrectly formatted and do not use the SET keyword appropriately. Option D has a syntax error with the '=' sign placed incorrectly, making it invalid.