获取缺失主键表信息的MYSQL语句
时间:2020-12-24 12:50:19|栏目: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 ;
上一篇:强制修改mysql的root密码的六种方法分享(mysql忘记密码)
栏 目:Mysql
本文标题:获取缺失主键表信息的MYSQL语句
本文地址:http://www.codeinn.net/misctech/36289.html