データベースクエリーあるデータベースのテーブル数

636 ワード

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直筆を明記してください.