mysql更改表字段类型

来源:互联网 发布:人工智能相关股票 编辑:程序博客网 时间:2024/04/29 00:21

1.更改Float字段类型to Decimal

ALTER TABLE 表名 MODIFY 字段名 decimal(10,2) not null default '0';
如:
ALTER TABLE invoice MODIFY TotalMoney decimal(10,2) not null  default '0';

2.添加字段

alter table 表名 add 字段名 字段类型 not null ;
如:
alter table teacher add TypeMark varchar(50) null default '';