Wednesday, July 3, 2013

Get new created table names in new databse by comparing 2 databases


select table_name 
from NEW_DATABASE_NAME.information_schema.columns as new
where not exists (select 'x' from OLD_DATABASE_NAME.information_schema.columns as old 
 where old.table_name=new.table_name
 and old.column_name=new.column_name)
and table_name not in (select distinct table_name 
  from OLD_DATABASE_NAME.information_schema.columns as old)
group by table_name


No comments:

Post a Comment