What is an aggregate function?
💡 Model Answer
An aggregate function performs a calculation on a set of values and returns a single value. Common examples include COUNT, SUM, AVG, MIN, and MAX. These functions are used in SELECT statements, often together with GROUP BY, to aggregate rows that share a common attribute. For instance, SELECT department, COUNT(*) FROM employees GROUP BY department; returns the number of employees in each department. Aggregate functions can also be used in HAVING clauses to filter groups based on aggregate criteria. They are essential for summarizing data, generating reports, and performing analytical queries. In many SQL dialects, aggregate functions can be combined with window functions to compute running totals or moving averages without collapsing rows. Understanding how and when to use aggregate functions is fundamental for database querying and data analysis.
Sign in to unlock the rest of this answer
This answer was generated by AI for study purposes. Use it as a starting point — personalize it with your own experience.
🎤 Get questions like this answered in real-time
Assisting AI listens to your interview, captures questions live, and gives you instant AI-powered answers on a discreet on-screen overlay.
Get Assisting AI — Starts at ₹500