admin管理员组文章数量:1638806
information_schema.tables
- 数据库information_schema
- 数据表tables
- 建表语句
- 常用字段
- 查询
数据库information_schema
information_schema是mysql数据库的一个系统数据库,它提供了数据库元数据的访问方式,保存着关于MySQL服务器所维护的所有其他数据库的信息。如数据库名,数据库的表,表栏的数据类型与访问权限等。
数据表tables
tables存储了数据表的元数据信息:
建表语句
CREATE TEMPORARY TABLE `TABLES` (
`TABLE_CATALOG` varchar(512) NOT NULL DEFAULT '',
`TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '',
`TABLE_NAME` varchar(64) NOT NULL DEFAULT '',
`TABLE_TYPE` varchar(64) NOT NULL DEFAULT '',
`ENGINE` varchar(64) DEFAULT NULL,
`VERSION` bigint(21) unsigned DEFAULT NULL,
`ROW_FORMAT` varchar(10) DEFAULT NULL,
`TABLE_ROWS` bigint(21) unsigned DEFAULT NULL,
`AVG_ROW_LENGTH` bigint(21) unsigned DEFAULT NULL,
`DATA_LENGTH` bigint(21) unsigned DEFAULT NULL,
`MAX_DATA_LENGTH` bigint(21) unsigned DEFAULT NULL,
`INDEX_LENGTH` bigint(21) unsigned DEFAULT NULL,
`DATA_FREE` bigint(21) unsigned DEFAULT NULL,
`AUTO_INCREMENT` bigint(21) unsigned DEFAULT NULL,
`CREATE_TIME` datetime DEFAULT NULL,
`UPDATE_TIME` datetime DEFAULT NULL,
`CHECK_TIME` datetime DEFAULT NULL,
`TABLE_COLLATION` varchar(32) DEFAULT NULL,
`CHECKSUM` bigint(21) unsigned DEFAULT NULL,
`CREATE_OPTIONS` varchar(255) DEFAULT NULL,
`TABLE_COMMENT` varchar(2048) NOT NULL DEFAULT ''
) ENGINE=MEMORY DEFAULT CHARSET=utf8
常用字段
字段 | 名称 | 说明 |
---|---|---|
table_schema | 数据库名称 | |
table_name | 数据表名称 | |
table_type | 数据表类型 | |
engine | 引擎 | |
table_rows | 数据表记录总数 | 一般小于真实记录数 |
create_time | 建表时间 | |
update_time | 修改表时间 | |
table_comment | 备注 |
查询
- 查询数据库有多少表
select count(*) from tables where table_schema = ‘test’;
- 查询数据有哪些数据表
select table_name from tables where table_schema = 'test';
- 查询各个数据表记录数
select table_rows from tables where table_schema = 'test';(不准确) 或 select count(*) from tableName [条件];(准确,慢) 或 select sql_calc_found_rows 1 from t limit 1;(准确,快) select found_rows() as count;
本文标签: 数据库数据mysqlTablesinformationschema
版权声明:本文标题:mysql数据库information_schema之tables数据表表 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/dongtai/1729279381a1193881.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论