顯示資料庫中表數目的 MySQL 查詢是什麼?
比如說,此處我使用 WEB 資料庫。我們需要查詢資料庫 WEB 中的表數。為此,在 MySQL 中使用 INFORMATION_SCHEMA.TABLES。
以下是顯示錶數的查詢 −
mysql> select count(table_name) as TotalNumberOfTablesInWebDatabase -> from information_schema.tables -> where table_schema='web';
這將產生以下輸出 −
+----------------------------------+ | TotalNumberOfTablesInWebDatabase | +----------------------------------+ | 1562 | +----------------------------------+ 1 row in set (0.27 sec)
為了檢查前面顯示的記錄數量是否相同,請使用 SHOW TABLES 命令。該命令會像下面這樣顯示具有結尾數量的所有記錄−
廣告