Saturday, October 24, 2015

SQL -- Aggregate Functions

The following example summarize the numeric results of a column. Here a list of agregate funtions:


MIN
returns the smallest value in a given column
MAX
returns the largest value in a given column
SUM
returns the sum of the numeric values in a given column
AVG
returns the average value of a given column
COUNT
returns the total number of values in a given column
COUNT(*)
returns the number of rows in a table





Here is an example of selecting the maximum price of any item ordered in the item_ordered table.



SELECT MAX(price)
FROM items_ordered;




No comments:

Post a Comment