美文网首页
SQL - Alter用法总结

SQL - Alter用法总结

作者: 黄小白i | 来源:发表于2020-06-07 17:15 被阅读0次

    一、修改表结构和字段值

    1、增加列

    Alter table 表名 add column 字段名 字段定义

    例子:Alter table student add column address varchar(50) null Default null Comment ‘1:xxx,2:xxx’ After 某个字段名;

    2、修改列

    Alter table 表名 modify 字段名 字段定义

    Alter table student Modify address varchar(50) null Default null Comment ‘1:xxx,2:xxx’ After 某个字段名;

    3、删除列

    Alter table 表名 Drop column 字段名;

    Alter table student Drop column address;

    4、修改列名

    Alter table 表名 rename column old列名 to new列名;

    相关文章

      网友评论

          本文标题:SQL - Alter用法总结

          本文链接:https://www.haomeiwen.com/subject/ukbctktx.html