一、Oracle
SELECT TABLE_NAME 表名, COUNT_ROWS(TABLE_NAME) 记录数 FROM USER_TABLES
二、MySQL
SELECT TABLE_NAME 表名,TABLE_ROWS 记录数 FROM information_schema.`TABLES` WHERE TABLE_SCHEMA = (SELECT database()) ORDER BY TABLE_ROWS DESC;
三、SQL Server
SELECT A.NAME 表名, B.ROWS 记录数 FROM SYSOBJECTS AS A INNER JOIN SYSINDEXES AS B ON A.ID = B.ID WHERE A.TYPE = 'U' AND B.INDID IN ( 0, 1 ) ORDER BY A.NAME,B.ROWS DESC;
四、PgSQL
SELECT RELNAME AS 表名, RELTUPLES AS 记录数 FROM PG_CLASS WHERE RELKIND = 'r' AND RELNAMESPACE = (SELECT OID FROM PG_NAMESPACE WHERE NSPNAME='public') ORDER BY 记录数 DESC;