Listar todas las tablas y número de registros en Mysql

Listar todas las tablas y número de registros en Mysql

Se presenta la necesidad desde la linea de comandos en mysql, listar todas las tablas de una base de datos y su correspondiente número de registros o filas que cada una tenga.

Así pues, se procede a ejecutar el siguiente comando….

SELECT table_name, table_rows
    FROM INFORMATION_SCHEMA.TABLES
    WHERE TABLE_SCHEMA = 'BaseDatos';

Así por ejemplo, en la siguiente consulta….

mysql> SELECT table_name, table_rows FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'cucese5_mood589';

La siguiente es la salida …

+------------------------------------+------------+
| table_name                         | table_rows |
+------------------------------------+------------+
| mdl_assign                         |         31 |
| mdl_assign_grades                  |          0 |
| mdl_assign_plugin_config           |        248 |
| mdl_assign_submission              |        256 |
| mdl_assign_user_flags              |          0 |
| mdl_assign_user_mapping            |        460 |
| mdl_assignfeedback_comments        |        255 |
| mdl_assignfeedback_editpdf_annot   |          0 |
| mdl_assignfeedback_editpdf_cmnt    |          0 |
| mdl_assignfeedback_editpdf_quick   |          0 |
| mdl_assignfeedback_file            |         16 |
| mdl_assignment                     |        268 |
| mdl_assignment_submissions         |       7692 |
| mdl_assignment_upgrade             |          0 |
| mdl_assignsubmission_file          |        256 |
| mdl_assignsubmission_onlinetext    |          0 |
| mdl_backup_controllers             |          0 |
| mdl_backup_courses                 |          0 |
| mdl_backup_logs                    |          0 |
| mdl_badge                          |          0 |
| mdl_badge_backpack                 |          0 |
| mdl_badge_criteria                 |          0 |
| mdl_badge_criteria_met             |          0 |
| mdl_badge_criteria_param           |          0 |
| mdl_badge_external                 |          0 |
| mdl_badge_issued                   |          0 |
| mdl_badge_manual_award             |          0 |
| mdl_block                          |         39 |
| mdl_block_community                |          0 |
| mdl_block_instances                |         11 |
| mdl_block_positions                |          1 |
| mdl_block_recent_activity          |          0 |
| mdl_block_rss_client               |          0 |
| mdl_blog_association               |          0 |
| mdl_blog_external                  |          0 |
| mdl_book                           |          0 |
| mdl_book_chapters                  |          0 |
| mdl_cache_filters                  |          0 |
| mdl_cache_flags                    |       3238 |
| mdl_capabilities                   |        483 |
| mdl_chat                           |          5 |
| mdl_chat_messages                  |         82 |
| mdl_chat_messages_current          |          0 |
| mdl_chat_users                     |          0 |
| mdl_choice                         |          0 |
| mdl_choice_answers                 |          0 |
| mdl_choice_options                 |          0 |
| mdl_cohort                         |          0 |
| mdl_cohort_members                 |          0 |
| mdl_comments                       |          0 |
| mdl_config                         |        426 |
| mdl_config_log                     |        852 |
| mdl_config_plugins                 |        876 |
| mdl_context                        |         26 |
| mdl_context_temp                   |          0 |
| mdl_course                         |          0 |
| mdl_course_categories              |         11 |
| mdl_course_completion_aggr_methd   |          0 |
| mdl_course_completion_crit_compl   |          0 |
......
| mdljl_workshopform_rubric_levels   |          0 |
+------------------------------------+------------+
630 rows in set (0,89 sec)

 

Views All Time
Views All Time
19
Views Today
Views Today
3

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *