Compare 2 tables structure on mysql
This query does the job to compare 2 table structures on mysql:
select column_name ,max(case when table_name = 'table_1' then 'Yes' end) as in_table_1 ,max(case when table_name = 'table_2' then 'Yes' end) as in_table_2 from information_schema.columns where table_name in('table_1', 'table_2') and table_schema = 'your_database' group by column_name order by column_name;
but it converts column names to smalls caps, 开发者_JAVA百科anyone know how tweak it to compare columns with mixed small and upper caps?
Per the MySQL manual:
"Column, index, stored routine, and event names are not case sensitive on any platform, nor are column aliases."
精彩评论