Finance[US] Career Guide Free Tutorials Go to Your University Placement Preparation 
0 like 0 dislike
in RTU/BTU B.Tech (CSE-IV Sem) DBMS Lab by Goeduhub's Expert (7.6k points)
Write the query for implementing the following functions: MAX(), MIN(), AVG() and COUNT().

1 Answer

0 like 0 dislike
by Goeduhub's Expert (7.6k points)
edited by
Best answer

Aggregate Functions

Aggregate Functions: Aggregate functions perform a calculation on a set of rows and return a single row. You can use aggregate functions as expressions only in the following clauses i.e., SELECT clause, HAVING clause. There are five aggregate functions: 

  • AVG() – returns the average value.
  • COUNT() – returns the number of values.
  • MAX() – returns the maximum value.
  • MIN() – returns the minimum value.
  • SUM() – returns the sum of all or distinct values.

AVG(): The AVG() function allows you to calculate the average value of a numeric column.

syntax : AVG(column)


Output : 


COUNT(): The COUNT function returns the total number of values in the specified field.

syntax : COUNT(expression)


Output : 


MAX() : It returns the maximum value from the specified table field.

syntax : MAX(expression)

SELECT MAX(Salary) FROM empl;

Output : 


MIN(): The MIN function returns the minimum value in the specified table field.

syntax : MIN(expression)

SELECT MIN(Salary)FROM empl;

Output : 


SUM(): SUM function which returns the sum of all the values in the specified column. SUM works on numeric fields only. Null values are excluded from the result returned.

syntax : SUM(expression)

SELECT SUM(Salary) "Total Salary" from empl;

Output : 

Total Salary

These functions are called aggregate functions because they operate on the aggregate of tuples. The result of an aggregate function is a single value.

For more Rajasthan Technical University CSE-IV Sem DBMS Lab Experiments CLICK HER

Learn & Improve In-Demand Data Skills Online in this Summer With  These High Quality Courses[Recommended by GOEDUHUB]:-

Best Data Science Online Courses[Lists] on:-

Claim your 10 Days FREE Trial for Pluralsight.

Best Data Science Courses on Datacamp
Best Data Science Courses on Coursera
Best Data Science Courses on Udemy
Best Data Science Courses on Pluralsight
Best Data Science Courses & Microdegrees on Udacity
Best Artificial Intelligence[AI] Courses on Coursera
Best Machine Learning[ML] Courses on Coursera
Best Python Programming Courses on Coursera
Best Artificial Intelligence[AI] Courses on Udemy
Best Python Programming Courses on Udemy

 Important Lists:

Important Lists, Exams & Cutoffs Exams after Graduation PSUs


About Us | Contact Us || Terms & Conditions | Privacy Policy ||  Youtube Channel || Telegram Channel © Social::   |  | 


Free Online Directory