Mysql表结构
表结构
desc 数据库名称.表名;
表中字段结构
select table_name,column_name,column_comment from information_schema.columns where table_schema ='表所在的库' and table_name = '要查看的表名' ;
information_schema.columns表字段解释
列名 | 数据类型 | 含义 |
---|---|---|
TABLE_CATALOG | nvarchar(128) | 表限定符。 |
TABLE_SCHEMA | nvarchar(128) | 表所有者。 |
TABLE_NAME | nvarchar(128) | 表名。 |
COLUMN_NAME | nvarchar(128) | 列名。 |
表的结构信息
select table_name,DATA_LENGTH ,INDEX_LENGTH from information_schema.tables where table_schema ='表所在的库' and table_name = '要查看的表名' ;
information_schema.tables表字段解释
列名 | 数据类型 | 含义 |
---|---|---|
TABLE_SCHEMA | varchar(64) | 数据库名称。 |
TABLE_NAME | varchar(64) | 数据表名。 |
ENGINE | varchar(64) | 引擎。 |
ROW_FORMAT | varchar(10) | 是否压缩。 |
DATA_LENGTH | bigint(21) | 表的大小。 |
INDEX_LENGTH | bigint(21) | 索引大小。 |
表的DDL语句
show create table 数据库名 .表名;
文中参考连接
https://www.cnblogs.com/maozp/p/11052525.html (sql查询)
http://blog.sina.com.cn/s/blog_160965eee0102xx3k.html (information_schema.cloum内容介绍)
https://www.cnblogs.com/ssslinppp/p/6178636.html (information_schema.table内容介绍)
https://www.cnblogs.com/diandiandidi/p/5582309.html (information_schema库信息介绍)