MySQL数据库中的非空表列表 [英] List of non-empty tables in MySQL database

查看:129
本文介绍了MySQL数据库中的非空表列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以让MySQL返回数据库中的所有非空表吗?类似于"SHOW TABLES",但只有那些不为空的表.

Can I get MySQL to return all non-empty tables in a database? Much like "SHOW TABLES" but only those that are not empty.

推荐答案

'information_schema'应该包含相关详细信息.你可以尝试

'information_schema' should be holding the relevant details. You can try

SELECT table_type,
       table_name
FROM information_schema.tables
WHERE table_rows >= 1;

从选择性数据库中进行选择.您也可以按TABLE_SCHEMA进行过滤:

to select from a selective database. You can also filter by TABLE_SCHEMA:

SELECT table_schema,
       table_type,
       table_name 
FROM information_schema.tables
WHERE table_rows >= 1
  AND TABLE_SCHEMA=?

这篇关于MySQL数据库中的非空表列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆