版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ailo555/article/details/82706756
mysql 查找所有数据库中没有主键的表:
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' --排除系统库
);