SQL 计算表中的行数 [英] SQL count rows in a table

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

问题描述

我需要向数据库发送一个 SQL 查询,该查询告诉我一个表中有多少行.我可以使用 SELECT 获取表中的所有行,然后对它们进行计数,但我不喜欢这样做.有没有其他方法可以向SQL Server询问表中的行数?

I need to send a SQL query to a database that tells me how many rows there are in a table. I could get all the rows in the table with a SELECT and then count them, but I don't like to do it this way. Is there some other way to ask the number of the rows in a table to the SQL server?

推荐答案

Yes, SELECT COUNT(*) FROM TableName

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

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