MySQL 查詢資料庫 資料表總記錄數

2021-09-27 10:14:18 字數 769 閱讀 4986

information_schema資料庫是mysql系統自帶的資料庫,它提供了資料庫元資料的訪問方式。information_schema就記錄了資料庫當中大部分基本的資訊,比如字符集,許可權相關,資料庫實體物件資訊,外檢約束,分割槽,壓縮表,表資訊,索引資訊,引數,優化,鎖和事物等等。通過information_schema我們可以窺透整個mysql例項的運**況,可以了結mysql例項的基本資訊,甚至優化調優,維護資料庫等。

select sum(table_rows) from information_schema.tables where table_schema = 'weibo';
select sum(table_rows) from information_schema.tables where table_schema = 'weibo'and table_name = 'wxyy';
mysql不會很智慧型的更新information_schema資料庫中tables資料表的table_rows,它只是乙個粗略的統計而已。

以下語句可以準確統計 

select count(*) from 資料庫.資料表;

MySQL 資料庫 資料表

1 檢視原始資料庫information schema中的表,並顯示出views表的字段結構屬性資訊 第一步 檢視所有的資料庫 show databases 如圖一 第二步 檢視information schema 內容 如圖二 第三步 檢視views 結構 如圖三 2 建立乙個offcn資料庫,並...

MySQL資料庫學習 資料表

1.開啟資料庫 use 資料庫名 2.檢視開啟的資料庫 select database 3.建立資料表 create table if not exists 表名 列名 資料型別 約束條件 4.檢視資料表結構 show columns from 表名 5.插入資料 insert into 表名 列名...

mysql庫和表 mysql資料庫和資料表

mysql資料庫可支援要求最苛刻的 web 電子商務和聯機事務處理 oltp 應用程式。它是乙個全面整合 事務安全 符合 acid 的資料庫,具備全面的提交 回滾 崩潰恢復和行級鎖定功能。mysql 憑藉其易用性 擴充套件力和效能,成為全球最受歡迎的開源資料庫。全球許多流量最大的 都依託於mysql...