I'm trying to change datatype from INT to FLOAT in MySQL like this:
ALTER TABLE user MODIFY rate float(5) NOT NULL
But current data is droped. Is there any way to convent\save data from INT to FLOAT with SQL?
I'm trying to change datatype from INT to FLOAT in MySQL like this:
ALTER TABLE user MODIFY rate float(5) NOT NULL
But current data is droped. Is there any way to convent\save data from INT to FLOAT with SQL?
I have just tried
ALTER TABLE user MODIFY rate float(5) NOT NULL
with mysql 5.6.26 and it worked without dropping the value.
ALTER TABLE `user` CHANGE rate intrate INTEGER;
ALTER TABLE `user` ADD rate float(5) NOT NULL DEFAULT 100;
UPDATE `user` SET rate=intrate;
ALTER TABLE `user` DROP intrate;