Get Record Count of Tables in MySQL

Get Record Count of a specific Table in MySQL.

SELECT 
    SUM(TABLE_ROWS) as 'Total Record Count'
FROM 
    information_schema.TABLES 
WHERE 
    table_schema = '$DATABASE_NAME'
    AND table_name = '$TABLE_NAME';

Get Record Count of all Tables of a specific schema in MySQL.

SELECT 
    SUM(TABLE_ROWS) as 'Total Record Count'
FROM 
    information_schema.TABLES 
WHERE 
    table_schema = '$DATABASE_NAME';

Get Record Count of all Tables of all specific schema in MySQL.

SELECT 
      table_schema 'Schema Name',
      SUM(TABLE_ROWS) as 'Total Record Count'
FROM 
     information_schema.tables 
GROUP BY table_schema; 
Please follow and like us:
Content Protection by DMCA.com