美文网首页
Mysql数据库的操作

Mysql数据库的操作

作者: 青山_8a0c | 来源:发表于2019-03-21 14:40 被阅读0次
    修改表-修改字段,重命名版:
    alter table 表名 change 原名 新名 类型及约束;
    alter table students change birthday birth datetime not null;
    修改表-修改字段,不重名版本:
    alter table 表名 modify 列名 类型和约束;
    alter table students modify birth date not null
    全列插入:insert into 表名 values(...)
    insert into students values(0,"郭靖", 1,"内蒙","2017-6");
    部分插入:值的顺序与给出的列顺序对应:
    insert into students(name, birthday) values("黄蓉","2017-8");
    修改:update 表名 set 列1=值1,列2=值2.。。where
    update students set gender=0, homwtown="古墓", where id = 5;
    备份:mysqldump -uroot -p 数据库名 》 python.sql,
    恢复:mysql -uroot -p 数据库名 < python.sql

    相关文章

      网友评论

          本文标题:Mysql数据库的操作

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