Jay Fisher

Use aggregate functions in query

Statements for Aggregate Functions

  • October 27, 2017 at 8:43 AM
  • Visible to public
/*Query 1 - Total cost of all Signs*/
SELECT ROUND(SUM(cost),2) AS 'Total Cost' FROM Signs;
/*Query 2 - Average cost of all Signs*/
SELECT ROUND(AVG((cost/quantity)), 2) AS 'Average Cost per Sign' FROM Signs;
/*Query 3 - Maximum Sqr Footage from list of signs*/
SELECT MAX(hor_dimens * vert_dimens) AS 'Most Sqr Ftg' FROM Signs;
/*Query 4 - Lowest price of any one sign from list*/
SELECT ROUND(MIN(cost/quantity),2) AS 'Lowest Priced Sign' FROM Signs;