Web developer can use special aggregate SQL functions which work with a set of values but return only a single value. For example, Web developer can use use an aggregate function to count the number of records in a table or to calculate the average price of a product:

C# 8.0 and .NET Core 3.0 – Modern Cross-Platform Development: Build applications with C#, .NET Core, Entity Framework Core, ASP.NET Core, and ML.NET using Visual Studio Code, 4th Edition
ASP.NET Core 3 and Angular 9: Full stack web development with .NET Core 3.1 and Angular 9, 3rd Edition
C# in Depth, 4th Edition

     – Avg(fieldname) – Calculates the average of all values in a given numeric field.
     -Sum(fieldname) – Calculates the sum of all values in a given numeric field.
     -Min(fieldname) or Max(fieldname) – Finds the minimum or maximum value in a number field.
     -Count(*) – Returns the number of rows in the result set.
     -Count(DISTINCT fieldname) – Returns the number of unique (and non-null) rows in the result set for the specified field.

For example, here’s a query that returns a single value—the number of records in the Vendors table:


And here’s how Web developer could calculate the total quantity of all sales by adding together the qty field in each record: