Skip to content

Instantly share code, notes, and snippets.

@dylansmith
Last active October 8, 2015 15:08
Show Gist options
  • Select an option

  • Save dylansmith/d6c677d4be121a4fa880 to your computer and use it in GitHub Desktop.

Select an option

Save dylansmith/d6c677d4be121a4fa880 to your computer and use it in GitHub Desktop.
Compare table counts across 2 MySQL databases
SELECT t1.TABLE_NAME, t1.TABLE_ROWS, t2.TABLE_ROWS
FROM INFORMATION_SCHEMA.TABLES t1, INFORMATION_SCHEMA.TABLES t2
WHERE t1.TABLE_NAME = t2.TABLE_NAME
AND t1.TABLE_SCHEMA = 'table1'
AND t2.TABLE_SCHEMA = 'table2'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment