Core SQL aggregates: Are COUNT, SUM, AVG, MAX, and MIN the standard built-in aggregate functions commonly available in SQL implementations?
-
AApplies — these five are the canonical built-in aggregates
-
BDoes not apply — only COUNT and SUM are built in
-
CApplies only in procedural extensions like PL/SQL
-
DDoes not apply — these are window functions only
Answer
Correct Answer: Applies — these five are the canonical built-in aggregates
Explanation
Introduction / Context:The question focuses on foundational SQL aggregate functions widely supported across major relational databases and taught in introductory courses.
Given Data / Assumptions:
- Standard SQL defines a set of core aggregates: COUNT, SUM, AVG, MIN, MAX.
- Vendors may add more aggregates (e.g., STDDEV, VARIANCE, LISTAGG), but the five listed are ubiquitous.
- Aggregates can be used with GROUP BY, HAVING, and windowing (OVER ...).
Concept / Approach:COUNT tallies rows/values, SUM totals numeric columns, AVG computes arithmetic mean, MIN/MAX find extrema. They skip NULLs except COUNT() which counts rows. These functions form the backbone of analytical SQL.
Step-by-Step Solution:Identify the functions listed.Recognize them as the standard built-in aggregates in SQL curricula and practice.Acknowledge vendors may offer more, but these five remain core.Conclude the statement is correct.
Verification / Alternative check:Any mainstream DBMS documentation (PostgreSQL, Oracle, SQL Server, MySQL) enumerates these aggregates as built-ins.
Why Other Options Are Wrong:Limiting to fewer functions or labeling them window-only is incorrect; window functions reuse these aggregates with OVER but they are aggregates first.
Common Pitfalls:Confusing COUNT() vs COUNT(column); forgetting DISTINCT can be applied inside SUM/AVG in some systems.
Final Answer:Applies — these five are the canonical built-in aggregates