INNER POST ADS

Recent Posts

Aggregate function

Monday, June 1, 2020
Aggregate functions are use to compute against a "returned column of numeric data" from your select statement.

They basically summarize the results of a particular column of selected data.

Aggregate functions are..

  • MIN: returns the smallest value in given column
E.g- SELECT MIN(Marks) As "Lowest marks"
        FROM Exam; 
  • MAX: return the largest value in a given column
E.g- SELECT MAX(Marks) As "Highest marks"
        FROM Exam; 
  • SUM: returns the sum of the numeric values in a given column
E.g- SELECT SUM(Marks) As "Total marks"
        FROM Exam
        WHERE Marks<35; 
  • AVG: returns the average value of a given column
E.g- SELECT AVG(Marks) As "Average marks"
        FROM Exam; 
  • COUNT: returns the total number of values in a given column
E.g- SELECT COUNT(Students) 
        FROM Students
        WHERE Marks<35;  
  • COUNT(*): returns the number of rows in a table
E.g- SELECT COUNT(*) 
        FROM Students 
        WHERE Marks<35;  


No comments:

Post a Comment