计算表中的行数 [英] Counting the number of rows in a table

查看:50
本文介绍了计算表中的行数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

获取MySQL数据库中特定表中的总行数是什么语法?

What's the syntax for getting the total number of rows in a particular table in a MySQL database?

推荐答案

我总是做完

SELECT count(*) FROM table

以上将为您提供所有行的总数.

The above will you give you the total count of all rows.

您可以轻松地附加WHERE子句以获取某些子集的计数

You could just as easily tack on a WHERE clause to get the count of some subset

SELECT count(*) FROM table WHERE foo = 'bar'

这篇关于计算表中的行数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆