Fid columns without primary or unique

SELECT t.TABLE_SCHEMA,t.TABLE_NAME,ENGINE FROM information_schema.TABLES t INNER JOIN information_schema.COLUMNS c ON t.TABLE_SCHEMA=c.TABLE_SCHEMA AND t.TABLE_NAME=c.TABLE_NAME AND t.TABLE_SCHEMA NOT IN ('performance_schema','information_schema','mysql') GROUP BY t.TABLE_SCHEMA,t.TABLE_NAME HAVING sum(if(column_key in ('PRI','UNI'), 1,0))=0;

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.