Question:

Describe the use of built-in MySQL functions like COUNT(), SUM(), and MAX().

Show Hint

  • {COUNT()} – Counts the number of records.
  • {SUM()} – Calculates the total of numeric values.
  • {MAX()} – Finds the largest value in a column.
These functions are commonly used with the \texttt{SELECT} statement to summarize data in a database.
Updated On: Mar 11, 2026
Hide Solution
collegedunia
Verified By Collegedunia

Solution and Explanation

Concept: MySQL provides several built-in aggregate functions that perform calculations on a set of values and return a single result. These functions are commonly used in database queries to summarize and analyze data stored in tables. 1. COUNT() Function The COUNT() function is used to count the number of rows or records in a table that satisfy a specified condition. Syntax: \[ \texttt{SELECT COUNT(column_name) FROM table_name;} \] Example: \[ \texttt{SELECT COUNT(ID) FROM Student;} \] This query counts the total number of student records in the \texttt{Student} table. 2. SUM() Function The SUM() function is used to calculate the total sum of numeric values in a column. Syntax: \[ \texttt{SELECT SUM(column_name) FROM table_name;} \] Example: \[ \texttt{SELECT SUM(Salary) FROM Employees;} \] This query calculates the total salary of all employees in the \texttt{Employees} table. 3. MAX() Function The MAX() function is used to find the maximum (largest) value in a column. Syntax: \[ \texttt{SELECT MAX(column_name) FROM table_name;} \] Example: \[ \texttt{SELECT MAX(Marks) FROM Student;} \] This query returns the highest marks obtained by a student in the \texttt{Student} table.
Was this answer helpful?
0
0