首页 >数据库 >mysql教程 >MYSQL分享:获取缺失主键表信息语句_MySQL

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

WBOY
WBOY原创
2016-06-01 13:34:011022浏览

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