I have a vector of values
vector = [ 10, 11, 10, 11, 12 ];
and an initialized database table
My goal is to update the value of each row ( which is initialized to -1 ) with a value from the vector. So the id =1, will have value 10, the id = 2, value 11 etc.
I can do this in a loop, ie for every value in vector update the corresponding row.
However I was wondering if I can do this with one update statement. I am using MySQL.
The final state after the update should be:
The Nth row (sorted) in the database should have the Nth value of the vector.

