Which of the following set of functions is a valid set of aggregate functions…
2023
Which of the following set of functions is a valid set of aggregate functions in MySQL?
- A.
AVG(), ROUND(), COUNT()
- B.
MIN(), UPPER(), AVG()
- C.
COUNT(), MAX(), SUM()
- D.
DATE(), COUNT(), LTRIM()
Attempted by 1410 students.
Show answer & explanation
Correct answer: C
Concept: aggregate vs scalar functions
An aggregate function takes the values across a GROUP of rows (a whole column, or each GROUP BY bucket) and collapses them into a single summary value — for example a total, a count, or an extreme value. A scalar function, by contrast, transforms one value per row and still returns one output value per input row. MySQL's standard aggregate functions are COUNT(), SUM(), AVG(), MIN(), and MAX() (plus a few others such as GROUP_CONCAT()).
Applying it to the options
Classifying each function offered in the options:
Function | What it does | Aggregate? |
|---|---|---|
AVG() | Averages a numeric column across rows into one value | Yes |
ROUND() | Rounds a single numeric value for that row | No |
COUNT() | Counts rows or non-NULL values across a group into one value | Yes |
MIN() | Returns the smallest value across a group of rows | Yes |
UPPER() | Converts a single text value to uppercase for that row | No |
MAX() | Returns the largest value across a group of rows | Yes |
SUM() | Totals a numeric column across rows into one value | Yes |
DATE() | Extracts the date part of a single datetime value for that row | No |
LTRIM() | Strips leading whitespace from a single string for that row | No |
Only the set COUNT(), MAX(), SUM() contains functions that are ALL aggregates. Each of the other three sets mixes in a scalar (per-row) function: ROUND() alongside AVG()/COUNT(); UPPER() alongside MIN()/AVG(); DATE() and LTRIM() alongside COUNT().
Cross-check
This matches MySQL's own reference manual, which places ROUND() under Mathematical Functions, UPPER() and LTRIM() under String Functions, and DATE() under Date and Time Functions — none of these three appear in the Aggregate Functions chapter, whereas COUNT(), MAX(), and SUM() do.
Result
So the valid set of MySQL aggregate functions among the given options is COUNT(), MAX(), SUM().