SELECT * FROM information_schema.tables AS t LEFT JOIN (SELECT DISTINCT table_schema, table_name FROM information_schema.`KEY_COLUMN_USAGE` ) AS kt ON kt.table_schema=t.table_schema AND kt.table_name = t.table_name WHERE t.table_schema NOT IN ('mysql', 'information_schema', 'performance_schema', 'test') AND kt.table_name IS NULL