In mysql database in user
table. I have a field named age
but now I would like to move all the contents of age
field to newly created field named age_min
. How can I do that? Thanks in advance..
你可以试试这个
UPDATE `user` SET age_min=age;
Simply do:
Update table set age=age_min;
It will replicate the value of the field age to the field age_min
试试这个qry ...
update `user` set `age_min` = `age`;
这应该做:
UPDATE user SET age_min = age;
You could copy all of the data to the new column:
UPDATE `user` SET `age_men` = `age`
OR you could just rename the existing column:
ALTER TABLE `user` CHANGE `age` `age_min` int
(you may have to drop the new column you just created in order to run the above query, if so, do this: ALTER TABLE user DROP age_min
SQL Fiddle:
运行此查询:
UPDATE `user` SET `age_min` = `age`
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.