Skip to content

Instantly share code, notes, and snippets.

@madaarya
Created July 27, 2017 03:56
Show Gist options
  • Select an option

  • Save madaarya/29b19bca0346e3d66b3f2afac522b13e to your computer and use it in GitHub Desktop.

Select an option

Save madaarya/29b19bca0346e3d66b3f2afac522b13e to your computer and use it in GitHub Desktop.
Get list of table from a database
SELECT
TABLE_NAME AS `Table`,
ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)`
FROM
information_schema.TABLES
WHERE
TABLE_SCHEMA = "salonist"
ORDER BY
(DATA_LENGTH + INDEX_LENGTH)
DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment