现在的位置: 首页 > 综合 > 正文

MYSQL 改变表结构 , 改变表数据, 改Column名字

2012年02月25日 ⁄ 综合 ⁄ 共 809字 ⁄ 字号 评论关闭

ALTER TABLE uni_chn_f_cffex_if_201209_R.convertmaininfo_t0_tick add `ShouldCount` bigint(20) not NULL AFTER `Count`

修改字段: 

alter table trader_10012369.tsncorder change CPrice CMaxPrice   double not null;

CPrice->CMaxPrice

ALTER TABLE `trader_10012369`.tsncorder CHANGE `CMinPrice` `CMinPrice` double AFTER `CPriceType` ;  

改变字段顺序

UPDATE `uni_chn_f_cffex_if_201208_r`.`convertinfo_t0_tick`  SET `Infomation`='CtpFiltered' where `Infomation`='filtered';
UPDATE `uni_chn_f_cffex_if_201208_r`.`convertinfo_t0_tick`  SET `VarietyCode`='IF' where `VarietyCode`='if';
UPDATE `uni_chn_f_cffex_if_201208_r`.`convertinfo_t0_tick`  SET `Source`='CTP_T' where `Source`='CTP T';

alter table `uni_chn_f_cffex_if_201208_R`.`convertinfo_t0_tick`  rename to `uni_chn_f_cffex_if_201208_R`.`convertdetailinfo_t0_tick`

参考资料:

http://wocclyl.blog.163.com/blog/static/46223504200832304528326/

抱歉!评论已关闭.