Home » MYSQL » Update Query » Question
  1. What is the value of val2?
    UPDATE t SET val1 = val1 + 2, val2 = val1;
    1. val1 + 1
    2. unchanged
    3. updated val1
    4. previous val1
    5. None of these
Correct Option: C

The second assignment here (val2 = val1) sets the value of val2 to the updated val1, that is, previous val1 incremented by two. ‘t’ is the name of the table here. ‘val1’ and ‘val2’ are columns.



Your comments will be displayed only after manual approval.