查询mysql没有主键的表

select table_schema, table_name
  from information_schema.tables
 where table_name not in (select distinct table_name
                            from information_schema.columns
                           where column_key = "PRI")
   AND table_schema not in
       (‘mysql‘, ‘information_schema‘, ‘sys‘, ‘performation_schema‘);

相关推荐