I need to add a new column NOT NULL whose value should be proportional to other field. Now the proportion is the same, but in the future could be diferent
By now my current script
ALTER TABLE myTable ADD COLUMN (basePrice FLOAT(10,2) NULL);
UPDATE myTable set basePrice = 0,9 * price;
ALTER TABLE myTable MODIFY COLUMN (basePrice FLOAT(10,2) NOT NULL);
but I would like to know if there is a way to do this in a single query in order to reduce the required time and avoid locks.