When working with databases, sometimes you want to find out how many rows will be returned by a query, without actually returning the results of the query. Or sometimes you might just want to find out how many rows are in a given table.
In SQL Server, you can use T-SQL‘s COUNT()
function to return the number of rows that would be returned in a query.