MySQL中获得所有表的名称:

MySQL语句中,‘mydata’是当前数据库的名称

information_schema.tables表示从表名中选择,information_schema.xxx中xxx可选的还有很多字段,如information_schema.columns表示从所有表的所有字段中选择。

MySQL字符串的连接使用concat函数,则按照要求可以有以下代码:

select concat(“select count(*) from “,table_name,”;”) as cnts 
from information_schema.tables where table_schema=’mydata’;

得到结果:


版权声明:本文为yf0523原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/yf0523/article/details/81116132