mysql字段操作

  1. 字段添加
    添加sex字段:
      alter table t1 add sex tinyint not null;
    在name字段后面添加sex字段:
      alter table t1 add sex tinyint not null after name;
    在第一列添加sex字段
      alter table t1 add sex tinyint not null first;  

     

  2. 字段删除
    alter table t1 drop sex;

     

  3. 修改字段
    修改字段名:
      alter table t1 change name username varchar(30) not null;
    修改属性:
      alter table t1 modify username varchar(50) not null;

     

posted @ 2019-04-14 21:53  yach_yu  阅读(347)  评论(0编辑  收藏  举报