首頁 >資料庫 >mysql教程 >MYSQL分享:获取缺失主键表信息语句_MySQL

MYSQL分享:获取缺失主键表信息语句_MySQL

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB原創
2016-06-01 13:34:011041瀏覽

bitsCN.com


MYSQL分享:获取缺失主键表信息语句

 

[sql] 

SELECT a.`TABLE_SCHEMA` AS DB_NAME , a.`TABLE_NAME` , a.`TABLE_ROWS` ,a.`ENGINE`  -- , a.*   

FROM   

information_schema.`TABLES` a  

LEFT JOIN  information_schema.`TABLE_CONSTRAINTS` b  

    ON a.`TABLE_NAME` = b.`TABLE_NAME` AND a.`TABLE_SCHEMA` = b.`TABLE_SCHEMA`   

WHERE b.`TABLE_SCHEMA` IS NULL   

AND a.`TABLE_TYPE` = 'BASE TABLE'  

AND a.`TABLE_SCHEMA` NOT IN ('information_schema','test','mysql','performance_schema')  

ORDER BY DB_NAME ,a.`TABLE_ROWS` DESC ;  

 

bitsCN.com
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn