查询存储引擎为MyISAM的表 ,查询所有没有主键的表

 

683 篇文章14 订阅

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' );

 

 

 

 

posted @ 2023-03-02 16:37  技术颜良  阅读(16)  评论(0编辑  收藏  举报