Skip to content

Instantly share code, notes, and snippets.

@putWorkDev
Last active August 29, 2015 14:18
Show Gist options
  • Select an option

  • Save putWorkDev/d645408ccfc9d8fb2adb to your computer and use it in GitHub Desktop.

Select an option

Save putWorkDev/d645408ccfc9d8fb2adb to your computer and use it in GitHub Desktop.
Determining the number of tables that are contained in a MySQL database is very straight-forward, although it is an often asked question. The simplest way to accomplish this is using the following SQL query. In this query, you will provide the database, and the SQL will access MySQL’s internal data scheme (information_schema).
SELECT count(*) as 'Tables', table_schema as 'Database'
FROM information_schema.TABLES
WHERE table_schema= 'spendanalysis'
GROUP BY table_schema
@hugo-serra

Copy link
Copy Markdown

Elegant solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment