zoukankan      html  css  js  c++  java
  • mysql 字段添加以及删除

    mysql> select * from user;
    +------+-----------+-----------+
    | id   | name      | address   |
    +------+-----------+-----------+
    |    1 | xiaoming  | beijing   |
    |    2 | xiaobai   | shandong  |
    |    3 | xiaohong  | suzhou    |
    |    4 | xiaohei   | changchun |
    |    5 | xiaoli    | dongjing  |
    |    6 | xiaohuang | meiguo    |
    |    1 | xiaoming  | beijing   |
    |    1 | xiaoming  | beijing   |
    |    1 | xiaoming  | beijing   |
    +------+-----------+-----------+
    9 rows in set (0.00 sec)
    
    
    mysql> alter table user add ziduan char(10) null;
    Query OK, 0 rows affected (0.05 sec)
    Records: 0  Duplicates: 0  Warnings: 0
    
    
    mysql> select * from user;
    +------+-----------+-----------+--------+
    | id   | name      | address   | ziduan |
    +------+-----------+-----------+--------+
    |    1 | xiaoming  | beijing   | NULL   |
    |    2 | xiaobai   | shandong  | NULL   |
    |    3 | xiaohong  | suzhou    | NULL   |
    |    4 | xiaohei   | changchun | NULL   |
    |    5 | xiaoli    | dongjing  | NULL   |
    |    6 | xiaohuang | meiguo    | NULL   |
    |    1 | xiaoming  | beijing   | NULL   |
    |    1 | xiaoming  | beijing   | NULL   |
    |    1 | xiaoming  | beijing   | NULL   |
    +------+-----------+-----------+--------+
    9 rows in set (0.00 sec)
    
    
    mysql> alter table user drop column ziduan;
    Query OK, 0 rows affected (0.06 sec)
    Records: 0  Duplicates: 0  Warnings: 0
    
    
    mysql> select * from user;
    +------+-----------+-----------+
    | id   | name      | address   |
    +------+-----------+-----------+
    |    1 | xiaoming  | beijing   |
    |    2 | xiaobai   | shandong  |
    |    3 | xiaohong  | suzhou    |
    |    4 | xiaohei   | changchun |
    |    5 | xiaoli    | dongjing  |
    |    6 | xiaohuang | meiguo    |
    |    1 | xiaoming  | beijing   |
    |    1 | xiaoming  | beijing   |
    |    1 | xiaoming  | beijing   |
    +------+-----------+-----------+
    9 rows in set (0.00 sec)

  • 相关阅读:
    IOC理论推导
    spring leile
    缓存
    动态SQL
    canvas小球运动
    jdk1.7后字符串的总结
    用ssm框架简单创建一个增删改查案列
    京东物流居家品类各区域联系人
    京东网址收藏
    京东自营申请新品打标方法
  • 原文地址:https://www.cnblogs.com/sea-stream/p/11312845.html
Copyright © 2011-2022 走看看