-- mysql 查看无主键的表
SELECT *
FROM information_schema.`TABLES` t
LEFT JOIN information_schema.STATISTICS s
ON t.TABLE_SCHEMA = s.TABLE_SCHEMA AND t.table_name = s.TABLE_NAME AND s.INDEX_NAME = 'PRIMARY'
WHERE t.TABLE_SCHEMA NOT IN ( 'mysql', 'performance_schema', 'information_schema', 'sys' )
AND t.TABLE_TYPE = 'BASE TABLE'
AND s.INDEX_NAME IS NULL
and t.TABLE_SCHEMA = 'xxxxxxxxxxxxxxxxxxxx'
;
标签:information,查看,mysql,TABLE,SCHEMA,主键,schema
From: https://www.cnblogs.com/chenzechao/p/17203005.html