centos7:mysql数据库(基本SQL语句---表操作)

时间:2022-09-12 21:00:05
表操作:
    增:
        #创建表
            create table 表名(字段名 数据类型(长度));

    删
        # 删除表
            drop table 表名;
            drop table 表1,表2,表3;
    
    改
        #修改表名
            alter table 原表名 rename to 新表名;

    查
        # 查询表的状态
            show table status from 表名\G
        # 列出当前库中所有的表
            show tables;
        # 查看表结构
            desc | describe 表名;
        # 查看创建表的SQL语句
            show create table 表名\G # \G:table字段和create table字段竖排
                eg. show create table stu\G