COUNT, SUM, and AVG Flashcards
What do SELECT COUNT statements do?
count the number of rows that appear in a database table
What is the basic SELECT COUNT statement format?
SELECT COUNT(*) FROM table_name;
How is the combination of SELECT COUNT and WHERE used?
to count how many rows meet a certain criteria
How is the combination of SELECT COUNT and GROUP BY used?
to count how many row meet each option in the column
What do SUM statements do?
add all values in a particular column
What is the basic SUM statement format?
SELECT SUM(column_name) FROM table_name;
What do MAX statements do?
find the largest value in a column
What is the basic MAX statement format?
SELECT MAX(column_name) FROM table_name;
What do MIN statements do?
find the smallest value in a column
What is the basic MIN statement format?
SELECT MIN(column_name) FROM table_name;
What do AVG statements do?
find the average value in a column
What is the basic AVG statement format?
SELECT AVG(column_name) FROM table_name;
What do ROUND statements do?
round the values in a column to a certain number of decimal places
What is the basic ROUND statement format?
ROUND(CONDITION(condition column_name), number_of_decimal_places, FROM table_name;