获取缺失主键表信息的MYSQL语句
获取缺失主键表信息的MYSQL语句
发布时间:2016-12-29 来源:查字典编辑
摘要:复制代码代码如下:SELECTa.`TABLE_SCHEMA`ASDB_NAME,a.`TABLE_NAME`,a.`TABLE_ROWS`...

复制代码 代码如下:

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 ;

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新mysql数据库学习
热门mysql数据库学习
编程开发子分类