Oracle:
select count(*) from user_tables;
MySQL:
SELECT table_schema AS 库名,COUNT(*) AS 表数量 FROM information_schema.TABLES WHERE table_schema = '查询数据库名' GROUP BY table_schema ;
说明:information_schema是mysql自带的数据库,存放着如数据库名、表明、权限的信息,TABLES存放的是表的信息。
例:
SELECT
COUNT(*) TABLES,
table_schema
FROM
information_schema.TABLES
WHERE table_schema = 'hhdzl'
GROUP BY table_schema ;
SQL server:
select count(*) from sysobjects where xtype='U';
转载请注明出处:BestEternity亲笔。