DEV Community

Cover image for PostgreSQL - AGGREGATE FUNCTION day 3
R.Shobika CSE
R.Shobika CSE

Posted on

PostgreSQL - AGGREGATE FUNCTION day 3

** AGGREGATE FUNCTIONS:**

  • Aggregate function is used to perform the calculation on set input values and return the single value .

  • Aggregate functions are:

  • sum,avg,min,max,and count

SUM()

select sum(empsalary) from employee;
Enter fullscreen mode Exit fullscreen mode

MIN()

select min(empsalary) from employee;
Enter fullscreen mode Exit fullscreen mode

MAX()

select max(empsalary) from employee;
Enter fullscreen mode Exit fullscreen mode

AVG()

select avg(empsalary) from employee;
Enter fullscreen mode Exit fullscreen mode

output:

ROUND()

GROUPBY

  • The GROUP BY clause groups rows that have the same values into summary rows
select emproll ,sum(salary) from employee group by emproll;
Enter fullscreen mode Exit fullscreen mode

output:

Top comments (0)