獲得缺掉主鍵表信息的MYSQL語句。本站提示廣大學習愛好者:(獲得缺掉主鍵表信息的MYSQL語句)文章只能為提供參考,不一定能成為您想要的結果。以下是獲得缺掉主鍵表信息的MYSQL語句正文
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 ;