Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

Unit 2: Aggregate Operators (Functions)

Lesson 21 of 28 in the free Database Management Systems notes on Siksha Sarovar, written by Rohit Jangra.

21.1 Introduction to Aggregate Functions

Aggregate functions perform a calculation on a set of values and return a single value. They are often used with the SELECT statement's GROUP BY clause.

21.2 The 5 Standard Aggregate Functions

FunctionDescriptionExample
COUNT()Returns the number of rows.COUNT(*) counts all rows.
SUM()Returns the total sum of a numeric column.SUM(Salary)
AVG()Returns the average value of a numeric column.AVG(Price)
MIN()Returns the smallest value of a column.MIN(Age)
MAX()Returns the largest value of a column.MAX(Marks)

21.3 Key Rules for Aggregates

  1. Aggregate functions (except COUNT(*)) ignore NULL values.
  2. Aggregate functions cannot be used in a WHERE clause. (This is a common mistake! Use HAVING instead).
  3. You can use the DISTINCT keyword inside an aggregate (e.g., COUNT(DISTINCT DeptID)).

21.4 Numeric vs. Non-Numeric Aggregates

  • SUM and AVG work only on numeric columns.
  • MIN, MAX, and COUNT work on any data type (e.g., MIN(Name) returns the first name alphabetically).