MySQL information_schema.tables

table_stype 为 enum类型取值
- BASE TABLE
- VIEW
- SYSTEM VIEW
用法:
- 某个schema是否存在某个table
select table_schema, table_name, table_type, table_rows from information_schema.tables where table_schema='information_schema' and table_type='SYSTEM VIEW' and table_name='INNODB_TABLESPACES'; - 某个schema是否存在某view
SELECT table_schema, table_name, table_type, table_rows FROM information_schema.TABLES WHERE table_schema = 'courier' AND table_type = 'VIEW' ORDER BY TABLE_TYPE - 统计某个库中所有表所有记录数
show table status from information_schema - 统计某库中BASE TABLE & VIEW 数量
SELECT table_schema, table_type, count( 1 ) FROM information_schema.TABLES WHERE table_schema = 'courier' GROUP BY table_schema, table_type - 统计某个库中表数

浙公网安备 33010602011771号