Informatics Practices

SQL Aggregate Functions MCQs | 25 Practice Questions with Answers | CBSE Class 12 Informatics Practices (IP)

Class 12 · Informatics Practices

SQL Aggregate Functions MCQs (25 Questions)

Practice these multiple-choice questions to strengthen your understanding of SQL Aggregate Functions. Click Show Answer to reveal the correct answer and explanation.


Q1. What is the purpose of SQL Aggregate Functions?

A. To create tables
B. To perform calculations on a group of rows and return a single value
C. To delete records
D. To modify table structure

Show Answer

Answer: B. To perform calculations on a group of rows and return a single value.

Explanation: Aggregate functions process multiple rows and return one summarized result.


Q2. Which SQL function returns the total number of records?

A. SUM()
B. COUNT()
C. AVG()
D. MAX()

Show Answer

Answer: B. COUNT()

Explanation: COUNT() counts the number of records or non-NULL values.


Q3. Which SQL function returns the sum of values in a numeric column?

A. AVG()
B. COUNT()
C. SUM()
D. MAX()

Show Answer

Answer: C. SUM()

Explanation: The SUM() function calculates the total of all numeric values in a column.


Q4. Which SQL function returns the average value of a numeric column?

A. SUM()
B. AVG()
C. MAX()
D. MIN()

Show Answer

Answer: B. AVG()

Explanation: AVG() calculates the arithmetic mean of numeric values.


Q5. Which SQL function returns the highest value in a column?

A. MIN()
B. MAX()
C. AVG()
D. SUM()

Show Answer

Answer: B. MAX()

Explanation: MAX() returns the largest value from a column.


Q6. Which SQL function returns the lowest value in a column?

A. MAX()
B. AVG()
C. MIN()
D. COUNT()

Show Answer

Answer: C. MIN()

Explanation: MIN() returns the smallest value in a column.


Q7. Which query counts all rows in the Student table?

A. SELECT COUNT(*) FROM Student;
B. SELECT SUM(*) FROM Student;
C. SELECT AVG(*) FROM Student;
D. SELECT MAX(*) FROM Student;

Show Answer

Answer: A.

Explanation: COUNT(*) counts every row in the table.


Q8. Which query calculates the total salary of all employees?

A. SELECT COUNT(Salary) FROM Employee;
B. SELECT SUM(Salary) FROM Employee;
C. SELECT AVG(Salary) FROM Employee;
D. SELECT MAX(Salary) FROM Employee;

Show Answer

Answer: B.

Explanation: SUM() returns the total of all salary values.


Q9. Which query calculates the average marks of students?

A. SELECT SUM(Marks) FROM Student;
B. SELECT AVG(Marks) FROM Student;
C. SELECT COUNT(Marks) FROM Student;
D. SELECT MIN(Marks) FROM Student;

Show Answer

Answer: B.

Explanation: AVG() calculates the average of all marks.


Q10. Which query finds the highest salary?

A. SELECT MIN(Salary) FROM Employee;
B. SELECT MAX(Salary) FROM Employee;
C. SELECT AVG(Salary) FROM Employee;
D. SELECT SUM(Salary) FROM Employee;

Show Answer

Answer: B.

Explanation: MAX() returns the highest salary value.


Q11. Which query finds the minimum price of a product?

A. SELECT MIN(Price) FROM Product;
B. SELECT MAX(Price) FROM Product;
C. SELECT AVG(Price) FROM Product;
D. SELECT COUNT(Price) FROM Product;

Show Answer

Answer: A.

Explanation: MIN() returns the smallest value in the Price column.


Q12. Which aggregate function works only with numeric data?

A. SUM()
B. AVG()
C. MAX()
D. Both A and B

Show Answer

Answer: D. Both A and B

Explanation: SUM() and AVG() require numeric values.


Q13. Which aggregate function can be used with both numeric and text data?

A. COUNT()
B. SUM()
C. AVG()
D. MOD()

Show Answer

Answer: A. COUNT()

Explanation: COUNT() counts records regardless of whether the column contains numbers or text.


Q14. Which function ignores NULL values while calculating the result?

A. SUM()
B. AVG()
C. COUNT(column)
D. All of these

Show Answer

Answer: D. All of these

Explanation: Aggregate functions ignore NULL values when performing calculations.


Q15. Which statement about aggregate functions is correct?

A. They summarize data.
B. They return a single value.
C. They work on multiple rows.
D. All of these.

Show Answer

Answer: D. All of these.

Explanation: Aggregate functions process multiple rows and return one summarized result.



Q16. What is the difference between COUNT(*) and COUNT(column_name)?

A. Both always return different results.
B. COUNT(*) counts all rows, while COUNT(column_name) counts only non-NULL values in the specified column.
C. COUNT(column_name) counts all rows including NULL values.
D. There is no difference.

Show Answer

Answer: B.

Explanation: COUNT(*) counts every row, whereas COUNT(column_name) ignores NULL values in that column.


Q17. Which query returns the total number of employees in the Employee table?

A. SELECT COUNT(*) FROM Employee;
B. SELECT SUM(*) FROM Employee;
C. SELECT AVG(*) FROM Employee;
D. SELECT MAX(*) FROM Employee;

Show Answer

Answer: A.

Explanation: COUNT(*) counts every record in the table.


Q18. A school wants to calculate the average marks of all students. Which query should be used?

A. SELECT SUM(Marks) FROM Student;
B. SELECT AVG(Marks) FROM Student;
C. SELECT COUNT(Marks) FROM Student;
D. SELECT MAX(Marks) FROM Student;

Show Answer

Answer: B.

Explanation: AVG() calculates the arithmetic mean of all values in the Marks column.


Q19. Which query finds the highest marks obtained by any student?

A. SELECT MIN(Marks) FROM Student;
B. SELECT MAX(Marks) FROM Student;
C. SELECT AVG(Marks) FROM Student;
D. SELECT SUM(Marks) FROM Student;

Show Answer

Answer: B.

Explanation: MAX() returns the largest value from the Marks column.


Q20. Which query returns the total fees collected from all students?

A. SELECT COUNT(Fees) FROM Student;
B. SELECT AVG(Fees) FROM Student;
C. SELECT SUM(Fees) FROM Student;
D. SELECT MAX(Fees) FROM Student;

Show Answer

Answer: C.

Explanation: SUM() adds all numeric values in the Fees column.


Q21. Which aggregate function would you use to find the lowest salary in a company?

A. MAX()
B. SUM()
C. MIN()
D. AVG()

Show Answer

Answer: C.

Explanation: MIN() returns the smallest value in the Salary column.


Q22. A table contains 100 records, but 10 values in the Phone column are NULL. What will COUNT(Phone) return?

A. 90
B. 100
C. 10
D. NULL

Show Answer

Answer: A. 90

Explanation: COUNT(column_name) counts only non-NULL values.


Q23. Which statement about SQL Aggregate Functions is TRUE?

A. They return a single summarized value.
B. They can be used in the SELECT clause.
C. They ignore NULL values in calculations.
D. All of these.

Show Answer

Answer: D.

Explanation: Aggregate functions summarize data, are used in the SELECT clause, and ignore NULL values during calculations.


Q24. Which of the following is NOT an SQL Aggregate Function?

A. COUNT()
B. SUM()
C. LENGTH()
D. AVG()

Show Answer

Answer: C. LENGTH()

Explanation: LENGTH() is a text function, whereas the others are aggregate functions.


Q25. Which statement best summarizes SQL Aggregate Functions?

A. They perform calculations on multiple rows.

B. They return one summarized value.

C. They include COUNT(), SUM(), AVG(), MIN(), and MAX().

D. All of these.

Show Answer

Answer: D. All of these.

Explanation: Aggregate functions summarize data by performing calculations across multiple rows and returning a single result.


Answer Key

Q.No. Answer Q.No. Answer Q.No. Answer
1B11A21C
2B12D22A
3C13A23D
4B14D24C
5B15D25D
6C16B
7A17A
8B18B
9B19B
10B20C

Practice Tips

  • Remember the five Aggregate Functions:
    • COUNT() → Counts records or non-NULL values.
    • SUM() → Calculates the total of numeric values.
    • AVG() → Calculates the average of numeric values.
    • MIN() → Finds the smallest value.
    • MAX() → Finds the largest value.
  • Know the difference:
    • COUNT(*) → Counts all rows, including rows with NULL values in any column.
    • COUNT(column_name) → Counts only non-NULL values in the specified column.
  • Aggregate functions ignore NULL values when performing calculations such as SUM(), AVG(), MIN(), MAX(), and COUNT(column_name).
  • Typical real-life uses:
    • Total sales → SUM()
    • Average marks → AVG()
    • Highest salary → MAX()
    • Lowest price → MIN()
    • Number of students → COUNT()
  • CBSE Tip: Many competency-based questions present an SQL query and ask you to identify the output or choose the correct aggregate function. Pay close attention to whether the question asks for a count, total, average, minimum, or maximum, and remember the behavior of NULL values.