CC SQL 12. summarizing Data

The flashcards below were created by user dau108 on FreezingBlue Flashcards.

  1. using aggregate functions
    • Function Description
    • AVG() Returns a column's average value
    • COUNT() Returns the number of rows in a column
    • MAX() Returns a column's highest value
    • MIN() Returns a column's lowest value
    • SUM() Returns the sum of a column's values
  2. aggregates on distinct values
    • The five aggregate functions can all be used in two ways:
    • 1. To perform calculations on all rows, specify the ALL argument, or specify no argument at all (because ALL is the default behavior).
    • 2. To only include unique values, specify the DISTINCT argument.

    Tip ALL Is Default The ALL argument need not be specified because it is the default behavior. If DISTINCT is not specified, ALL is assumed.

    • example:
    • SELECT AVG(DISTINCT prod_price) AS avg_price
    • FROM products
    • WHERE vend_id = 1003;
  3. combining aggregate functions
    • SELECT COUNT(*) AS num_items,
    • MIN(prod_price) AS price_min,
    • MAX(prod_price) AS price_max,
    • AVG(prod_price) AS price_avg
    • FROM products;
Card Set:
CC SQL 12. summarizing Data
2012-04-08 09:07:29
CC SQL 12 summarizing Data

CC SQL 12. summarizing Data
Show Answers: