zoukankan      html  css  js  c++  java
  • MySQL修改表结构--添加删除字段

    MySQL修改表结构包含诸多的功能,下面介绍的MySQL修改表结构操作实现的是字段的添加及删除等,如果您对MySQL修改表结构方面感兴趣的话,不妨一看。

    MySQL修改表结构--添加字段:

    alter table `user_movement_log`
    Add column GatewayId int not null default 0 AFTER `Regionid` (在哪个字段后面添加)

    MySQL修改表结构--删除字段:

    alter table `user_movement_log` drop column Gatewayid

    调整字段顺序:

    ALTER TABLE `user_movement_log` CHANGE `GatewayId` `GatewayId` int not null default 0 AFTER RegionID

    //主键

    alter table tabelname add new_field_id int(5) unsigned default 0 not null auto_increment ,add primary key (new_field_id);

    //增加一个新列

    alter table t2 add d timestamp;
    alter table infos add ex tinyint not null default ’0′;

    //删除列

    alter table t2 drop column c;

    //重命名列

    alter table t1 change a b integer;

    //改变列的类型

    alter table t1 change b b bigint not null;
    alter table infos change list list tinyint not null default ’0′;

    //重命名表

    alter table t1 rename t2;

  • 相关阅读:
    D触发器深入详细介绍(zhuanzai)
    脉冲
    数字电路中时序
    嵌入式中对某一位清0或置1
    8本推荐阅读的UX书籍
    Hadoop之HDFS的Shell操作
    Hadoop之HDFS概述
    Hadoop之搭建完全分布式运行模式
    Hadoop之运行模式
    Hadoop之运行环境搭建
  • 原文地址:https://www.cnblogs.com/txd66/p/3255064.html
Copyright © 2011-2022 走看看