mysql 查找没有主键(primary key)的表

select table_schema, table_name
  from information_schema.tables
 where 1=1
   and table_name not in (
        select distinct table_name
          from information_schema.columns
         where 1=1
		   and column_key = "PRI")
   and table_schema not in (
        'mysql', 
		'information_schema', 
		'sys', 
		'performance_schema'
	   );

你可能感兴趣的:(#,mysql,check,mysql,primary,key)