需求場景:
現要查詢某個庫下50個表每個表的表名和對應的數據量,通過pLsql工具運行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):