• 一个备份语句和常用的修改表的语句


    SELECT CONCAT("mysqldump -uroot -poldboy123 ",TABLE_SCHEMA,"  ",TABLE_NAME,"  >/tmp/",TABLE_SCHEMA,"/",TABLE_SCHEMA,"_",TABLE_NAME,".sql")
    
    FROM information_schema.`TABLES` WHERE TABLE_SCHEMA='world' INTO OUTFILE '/tmp/bf.sh'


    [mysqld]

    secure-file-priv=/tmp
    -- 加入上面语句重启mysql




    创建表:
       create table test(id int);
       create table t1(idcard int ,name char(30),sex char(4));
       修改表定义:
        修改表名:
       rename table t1 to test1;
       alter table test1 rename to people;
        修改表结构:
       alter table people  add addr char(40) NOT NULL;
        指定添加年龄列到name列后面的位置,示例如下:
       alter table people add age int(4) after name;
        通过下面的命令在第一列添加qq字段。
       alter table test add telnum  int  first;
        同时添加多个列定义:
       alter table people add id int first ,add sex char(4) after name ;
        删除表结构:
       alter table people  drop  sex;
        修改表定义
       alter table people modify name char(20);
        修改列名:
       alter table people change name people_name char(30) ;

  • 相关阅读:
    python setup.py install 失败
    Python xlsx 读取
    Java ArrayList Sort
    java console ( mac osx ) 命令行编码
    Lucene Query Term Weighting
    Fast Intro To Java Programming (2)
    随感 20150512
    循环数组中找查找某个数值
    数字内组合得到下一个比该数大的数
    android activity空指针异常解决问题解决
  • 原文地址:https://www.cnblogs.com/gaoyuechen/p/8059116.html
Copyright © 2020-2023  润新知