创建mysql数据库的命令

建议使用

create database test character set utf8mb4 collate utf8mb4_bin;

查看表结构

DESC 表名;

主要是字段类型,主键,是否允许为空等。

查看表中字段的结构信息

  可以用来查看表中字段的注释等,比如

select  table_name,column_name,column_comment  from information_schema.columns where table_schema ='表所在的库'  and table_name = '要查看的表名' ;

查看库里面表的结构信息

  可以用来查看表的注释信息

select table_name,table_comment from information_schema.tables where table_schema = '表所在的库' and table_name ='表名' ;

  去掉 table_name 限定条件,即可查看指定库中的所有表信息

查看表的DDL语句

show create table 表名;
posted @ 2020-12-24 16:43  心如止水-杜  阅读(368)  评论(0编辑  收藏  举报
技术文章,欢迎转载,转载请注明出处。 杜鹤飞的技术博客 邮箱地址:dhf327@163.com