• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Summary

The SQL aggregate functions perform calculations on data, returning the calculation results instead of the data itself. The standard aggregate functions are AVG, COUNT, MAX, MIN, and SUM. Aggregate calculations can filter data as needed using combinations of WHERE and HAVING, and data can be grouped using GROUP BY.

Sample Questions

1:Which SELECT clause must be used in order to obtain counts or other aggregates for different rows (as opposed to for all rows)?
  1. ORDER BY

  2. GROUP BY

  3. HAVING

  4. WHERE

2:What is wrong with the following SQL statement?
SELECT product_name, COUNT(*)
FROM products
GROUP BY product_name
HAVING MAX(prod_price) > 10

  1. It doesn't have a WHERE clause.

  2. The ORDER BY clause is missing.

  3. The alias is missing.

  4. The HAVING clause does not match the SELECT list.

3:Which of the following are valid aggregate functions?
  1. AVERAGE

  2. COUNT

  3. TOTAL

  4. MIN


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint