Monday, 28 December 2015

Get record counts for all tables in MySQL database

mysql>SELECT TABLE_NAME,SUM(TABLE_ROWS) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'db_name' GROUP BY TABLE_NAME;

 The COUNT(*) function returns the number of records in a table:

mysql> SELECT COUNT(*) FROM tiki_user_preferences;

No comments:

Post a Comment