MYSQL-计算每个表中的行数 [英] MYSQL - count number of rows in each table
本文介绍了MYSQL-计算每个表中的行数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道数据库中每个表中有多少行.我已经做到了
I would like to know how many rows are in each table in my database. I've come so far as to having
select count(*) _tablename_;
但是,我将需要在每张桌子上这样做-而且有很多.我如何用表名及其行数打印输出的最佳方法是什么?
However i would need to do that on each and every table - and there are a lot. What would me the best way to get a print-out with the table name and it's row count?
推荐答案
SELECT table_name, table_rows
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA = '<your db>';
我也希望您意识到查询中存在错误:它缺少FROM
.
I also hope you realise there's an error in your query: it's missing a FROM
.
这篇关于MYSQL-计算每个表中的行数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文