mysql quick query row count using sql

Posted lenmom

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql quick query row count using sql相关的知识,希望对你有一定的参考价值。

1. command

show table status like table-name;

 

2. sample

mysql> use inventory;
Database changed
mysql> show tables;
+---------------------+
| Tables_in_inventory |
+---------------------+
| customers           |
| decimalTest         |
| orders              |
| orders1             |
| products            |
| products_on_hand    |
| t_amount_cumulation |
| t_member_inf        |
| test                |
| test2               |
+---------------------+
10 rows in set (0.00 sec)

mysql> show table status like ‘customers‘;
+-----------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+---------+
| Name      | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length | Index_length | Data_free | Auto_increment | Create_time         | Update_time | Check_time | Collation       | Checksum | Create_options | Comment |
+-----------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+---------+
| customers | InnoDB |      10 | Dynamic    |    4 |           4096 |       16384 |               0 |        16384 |         0 |           1006 | 2019-06-13 02:15:15 | NULL        | NULL       | utf8_unicode_ci |     NULL |                |         |
+-----------+--------+---------+------------+------+----------------+-------------+-----------------+--------------+-----------+----------------+---------------------+-------------+------------+-----------------+----------+----------------+---------+
1 row in set (0.00 sec)

 The output result indicate the row number of the table: customers is 4.

技术图片

 

以上是关于mysql quick query row count using sql的主要内容,如果未能解决你的问题,请参考以下文章

Query OK, 1 row affected (43.05 sec)

使用旧版本的 MYSQL 复制行号

mysql_query() 为 FALSE 但 mysql_error() 为空

如何轻松遍历 MySQL 结果?

php mysql/mysqli结果

php基础:while循环查出所有数据库表行