Created
October 19, 2016 08:09
-
-
Save dungmanh88/32a9969c8353ad934eed3bad2e131b6d to your computer and use it in GitHub Desktop.
Do all tables have primary key ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select t.table_schema, t.table_name | |
from information_schema.tables t | |
left join information_schema.statistics s | |
on t.table_schema=s.table_schema and t.table_name=s.table_name and s.non_unique=0 | |
where s.table_name is null and t.table_schema not in ('mysql', 'information_schema','performance_schema'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment