主键有无检测

select a.table_schema,a.table_name 

from information_schema.tables a left outer join information_schema.table_constraints b

on a.table_schema = b.table_schema and a.table_name = b.table_name and b.constraint_name in ('PRIMARY')

where b.table_name is null and a.table_schema not in ('information_schema','performance_schema','test','mysql', 'sys');
原文地址:https://www.cnblogs.com/igoodful/p/13684168.html