ExamVeda
Login
Home
This question belongs to MySQL MySQL Miscellaneous
MySQL Miscellaneous
?

What is the value of val2 in the following MySQL statement?
UPDATE t SET val1 = val1 + 2, val2 = val1;

Answer & Solution
Correct Answer: Option B
This MySQL statement uses the UPDATE command to modify the values in a table named 't'. Let's break down what's happening:
SET val1 = val1 + 2: This part increases the value of the 'val1' column by 2.
SET val2 = val1; This part assigns the updated value of 'val1' to the 'val2' column.
So, the answer is Option B: updated val1.
The 'val2' column will be assigned the value of 'val1' after it's been increased by 2.
Examveda
Question posted by Examveda
Community

Join the Discussion

No comments yet Be the first to discuss this question.