Rudy Limeback:
是的,这相当简单。
select 'Customers' as tablename
, count(*) as row_count
from Customers
union all
select 'Orders' as tablename
, count(*) as row_count
from Orders
union all
select 'Products' as tablename
, count(*) as row_count
from Products
union all
...
如果你需要在你的数据库里的所有表上做这个查询,青年人网站提示可以从INFORMATION_SCHEMA.TABLES视图生成表清单:
select table_name
from information_schema.tables
where table_schema = 'mydatabase'
然后你可以利用这个查询的结果集和一个文本编辑器生成第一个查询。
责任编辑:小草