mysql (mariadb)表结构添加修改删除方法总结

1,添加表字段

    alter table table1 add ptel varchar(100) not Null;

    alter table table1 add id int unsigned not Null auto_increment primary key;

    alter table table1 add tj int(1) not Nul default '1';

2,修改表字段

   alter table 表名称 change 字段名称 字段名称 字段类型 [是否允许非空];

   alter table 表名称 modify 字段名称 字段类型 [是否允许非空];

   alter table 表名称 modify 字段名称 字段类型 [是否允许非空];

3,删除表字段

    alter table table1 drop 字段名

上述来自玖乐网络(96net.com.cn)

posted @ 2017-12-27 15:50  学无边涯  阅读(2026)  评论(0)    收藏  举报