Skip to content

Instantly share code, notes, and snippets.

@vladimir-light
Created July 13, 2012 18:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vladimir-light/3106668 to your computer and use it in GitHub Desktop.
Save vladimir-light/3106668 to your computer and use it in GitHub Desktop.
Count all tables in a specific SCHEMA - MySQL
--
-- Only TABLES
--
SELECT COUNT(*) AS `all_tables`
FROM information_schema.`TABLES`
WHERE table_schema = '<schema_name>'
AND table_type = 'BASE TABLE'
--
-- EVERYTHING: TABLES, VIEWS, ETC
--
SELECT COUNT(*) AS `all_tables`
FROM information_schema.`TABLES`
WHERE table_schema = '<schema_name>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment