查询存储引擎为MyISAM的表 ,查询所有没有主键的表
select table_catalog
,table_schema
,table_name
,engine
from information_schema.tables
where engine='MyISAM';
查询所有没有主键的表
SELECT
table_schema,
table_name
FROM
information_schema.TABLES
WHERE
( table_schema, table_name ) NOT IN ( SELECT DISTINCT table_schema, table_name FROM information_schema.COLUMNS WHERE COLUMN_KEY = 'PRI' )
AND table_schema NOT IN ( 'sys', 'mysql', 'information_schema', 'performance_schema' );