Skip to content

Instantly share code, notes, and snippets.

@olivertappin
Created May 10, 2019 13:43
Show Gist options
  • Save olivertappin/c56327a944200f77ae44741f026d809d to your computer and use it in GitHub Desktop.
Save olivertappin/c56327a944200f77ae44741f026d809d to your computer and use it in GitHub Desktop.
Show counts of all table rows from a particular database using information_schema
SELECT
TABLE_NAME AS DATABASE_NAME,
FORMAT(TABLE_ROWS, 0) AS Rows
FROM information_schema.tables
WHERE
table_schema = 'DATABASE_NAME'
AND TABLE_ROWS > 0
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment