mysql 的常用sql


1. 新建索引

  alter table  'tab_yyy' add index 'IDX_Tab_ID'('id') using btree;

2.表中新增字段

  alter table 'table_xxx' add column 'id_customer' varchar(32) null comment '客户id'  after  'id_task';

3. 新建表结构

create table 'tab_sss'(

  'id' vachar(255) character set utf8 not null comment '主键',

  'task_id' vachar(32) character set utf8 default null comment '任务Id',

  'pay_amount' decimal(10,2) default null comment '支付金额',
  'created_by' vachar(100) character set utf8 not null default 'system' comment '创建人',   'created_date' datetime not null default current_timestamp comment '创建时间',   'updated_date' datetime not null default current_timestamp on update current_timestamp comment '更新时间',   primary key ('id'),   key 'IDX_task_id'('task_id') ) ENGINE = InnoDB DEFAULT CHARSET=UTF8 COLLATE=utf8_bin comment='操作记录表';