Showing posts with label avg. Show all posts
Showing posts with label avg. Show all posts

Friday, November 27, 2015

SQL -- Aggregate Functions (AVG)



Select the average price of all of the items ordered that were purchased in the month of Dec.



SELECT AVG(price)
FROM items_ordered
WHERE order_date LIKE '%Dec%';







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;