Teradata supports common aggregate functions. They can be used with the SELECT statement.

• COUNT − Counts the rows

• SUM − Sums up the values of the specified column(s)

• MAX − Returns the large value of the specified column

• MIN − Returns the minimum value of the specified column

• AVG − Returns the average value of the specified column

## Example

Consider the following Salary Table.

EmployeeNo Gross Deduction NetPay
101 40,000 4,000 36,000
104 75,000 5,000 70,000
102 80,000 6,000 74,000
105 70,000 4,000 66,000
103 90,000 7,000 83,000

## COUNT

The following example counts the number of records in the Salary table.

```SELECT count(*) from Salary;

Count(*)
-----------
5
```

## MAX

The following example returns maximum employee net salary value.

```SELECT max(NetPay) from Salary;
Maximum(NetPay)
---------------------
83000
```

## MIN

The following example returns minimum employee net salary value from the Salary table.

```SELECT min(NetPay) from Salary;

Minimum(NetPay)
---------------------
36000
```

## AVG

The following example returns the average of employees net salary value from the table.

```SELECT avg(NetPay) from Salary;

Average(NetPay)
---------------------
65800
```

## SUM

The following example calculates the sum of employees net salary from all records of the Salary table.

```SELECT sum(NetPay) from Salary;

Sum(NetPay)
-----------------
329000
```