Aggregate Functions Flashcards
What are Aggregates?
Calculations performed on multiple rows of a Table.
Which function is the fastest way to calculate how many rows are in a table?
COUNT( )
What does this statement do?
SELECT COUNT(*)
FROM _______;
Counts every row
Which function makes it easy to add all values in a particular column?
SUM( )
What does this statement do?
SELECT SUM(downloads)
FROM ______;
This adds all values in the downloads column
What does the SUM( ) function do?
It takes the name of a column as an argument and returns the sum of all the values in that column.
Where are arguments passed in the functions?
Inside the parentheses of the function.
Which function returns the highest values in a column?
MAX( )
Which function returns the lowest values in a column?
MIN( )
What do all functions have in common?
They take the name of a column as an argument and return the value for the specified information in that column.
Which function quickly calculates the average value of a particular column?
AVG( )
What does this statement do?
SELECT AVG(downloads)
FROM fake_apps;
This statement returns the average number of downloads for an app in the database.
Which function makes the result Table easier to read?
ROUND( )
How many arguments does the ROUND( ) function take?
Two
What are the two arguments that the ROUND( ) function takes inside the parentheses?
A column name
An integer