需求场景:
现要查询某个库下50个表每个表的表名和对应的数据量,通过py-sql工具运行sql语句,可以以表格的形式展示(表明在左,对应的数据在右),也方便导入excel。
百度经验:
select 'Customers' as tablename, count(*) as row_count from Customers union all select 'Orders' as tablename, count(*) as row_count from Orders union all ……
我的两个表名:BANK_ACC, BANK_CONTRAL
组织查50个表的sql语句:
select 'BANK_ACC' as tablename, count(*) as row_count from BANK_ACC union all select 'BANK_CONTRAL' as tablename, count(*) as row_count from BANK_CONTRAL union all ...
结果展示(这种结果方便导入excel):