Mysql 查询某个数据库的空表,非空表和包含某个字段的表
作者:互联网
查询所有空表:
select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA ='数据库名称' and TABLE_ROWS = 0;
查询所有非空表:
select TABLE_NAME from information_schema.TABLES where TABLE_SCHEMA ='数据库名称' and TABLE_ROWS >0;
查询当前数据库包含某字段的所有表:
SELECT DISTINCT TABLE_NAME FROM information_schema.COLUMNS WHERE COLUMN_NAME = '字段名称' AND TABLE_SCHEMA='数据库名称';
标签:information,空表,NAME,数据库,非空表,某个,TABLE,schema,SCHEMA 来源: https://www.cnblogs.com/jackzhuo/p/15854624.html