zoukankan      html  css  js  c++  java
  • mysql 常用操作命令

    建库

    create database 库名

    选择库

    use 库名;

    显示数据库中的所有表

    show tables;

    显示数据库中的一个表

    show create table 表名;

    创建表

    create table 表名;

    删除表

    drop table 表名;

    添加列

    alter table 表名 add column 列名 not null ;

    修改列

    alter table 表名 modify column 列名 not null;

    添加主键

    alter table 表名 add primary key (列名);

    删除主键

    alter table 表名 drop primary key;

    添加索引

    alter table 表名 add index 索引名(列名);

    删除索引

    alter table 表名 drop index 索引名(列名);

    添加外键

    alter table 表名 add constraint 外键名 foreign key (列名)  references 指向的表名 (列名) on delete cascade on update cascade

    删除外键

    alter table 表名 drop constraint 外键名

    alter table 表名 drop foreign key 外键名

    修改引擎

    alter table 表名 type=InnoDB;

  • 相关阅读:
    BZOJ4407
    BZOJ 4804
    BZOJ 2820
    莫比乌斯反演入门
    BZOJ3261
    BZOJ 4327
    BZOJ1212
    AC自动机 板子
    派生类的访问控制-“三看”原则-派生类类成员访问级别设置的原则
    为什么不要重载 && 和 || 操作符!!!
  • 原文地址:https://www.cnblogs.com/zhaozhilu/p/2759103.html
Copyright © 2011-2022 走看看