Question:

Show the use of SQL functions: COUNT() and AVG().

Show Hint

SQL aggregate functions such as COUNT(), SUM(), AVG(), MIN(), and MAX() are used to perform calculations on multiple rows of data.
Updated On: Mar 14, 2026
Hide Solution
collegedunia
Verified By Collegedunia

Solution and Explanation

Step 1: Understand SQL functions.
SQL provides built-in functions to perform calculations on data stored in database tables. These functions simplify data analysis and retrieval.
Two commonly used SQL functions are COUNT() and AVG().
Step 2: Use of COUNT() function.
The COUNT() function is used to count the total number of rows or records in a table.
Example \[ \texttt{SELECT COUNT(*) FROM students;} \] This query returns the total number of records in the students table.
Step 3: Use of AVG() function.
The AVG() function calculates the average value of a numeric column.
Example \[ \texttt{SELECT AVG(marks) FROM students;} \] This query calculates the average marks of all students in the table.
Step 4: Conclusion.
Thus COUNT() is used for counting records and AVG() is used for calculating the average value of a column.
Was this answer helpful?
0
0