How to find the size and row count of your MySQL tables

Did you ever wonder how large the tables in your MySQL database are? Or how many rows each of you tables has? Use this query to list and sort your MySQL tables by size and row count.

SELECT 
     table_schema as `Database`, 
     table_name AS `Table`, 
     round(((data_length + index_length) / 1024 / 1024), 2) as `Size in MB`,
     table_rows as 'Number of rows'
FROM information_schema.TABLES 
WHERE table_schema = (SELECT DATABASE())
ORDER BY `Size in MB` DESC;