select count(1) from information_schema.columns where table_schema = "testdatabase" and table_name ='testtable'
//查看某个数据库中某个表有多少字段
select count(1) from information_schema.columns where table_schema = "testdatabase"
//查看某个数据库中整体有多少字段
select count(1) , table_schema from information_schema.tables where table_schema ='testdatabase'
//查看某个数据库中有多少表
select count(1) , table_schema from information_schema.tables group by table_schema
//查看所有的数据库中各有多少表
今天这个需求就被我碰到了,也不知道干嘛用,领导让统计,留下来统计方法把,给需要的猿们
本文记录了一次统计MySQL数据库中所有表及其字段数量的需求,提供了相关的方法,供需要进行此类统计的开发者参考。

被折叠的 条评论
为什么被折叠?



