To get the total number of rows in a MySQL database, you can use aggregate function SUM() along with inbuilt column TABLE_ROWS from INFORMATION_SCHEMA.TABLES.
#The synt## is as follows−SELECT SUM(TABLE_ROWS) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = database();假設我們正在使用名為'sample'的資料庫。 現在我們將取得MySQL資料庫中的總行數−
mysql> SELECT SUM(TABLE_ROWS) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = database();這將產生以下輸出−
+-----------------+ | SUM(TABLE_ROWS) | +-----------------+ | 2043 | +-----------------+ 1 row in set (22.11 sec)
以上是我們可以獲得 MySQL 資料庫的總行數嗎?的詳細內容。更多資訊請關注PHP中文網其他相關文章!