# Aggregate Functions

## **COUNT**&#x20;

The COUNT function returns the number of rows in a group. It counts all values including NULL values.

```sql
SELECT COUNT(column_name) FROM table_name; 
```

## **SUM**

The SUM function returns the total sum of values in a numeric column. It ignores NULL values.

```sql
SELECT SUM(column_name) FROM table_name;
```

## **AVG**&#x20;

The AVG function returns the average value of a numeric column. It ignores NULL values.

```sql
SELECT AVG(column_name) FROM table_name;
```

## **MAX**

The MAX function returns the maximum value in a set of values. It ignores NULL values.

```sql
SELECT MAX(column_name) FROM table_name;
```

## **MIN**&#x20;

The MIN function returns the minimum value in a set of values. It ignores NULL values.

```sql
SELECT MIN(column_name) FROM table_name;
```

## **FIRST**&#x20;

The FIRST function returns the first value in a set of values. It ignores NULL values.

```sql
SELECT FIRST(column_name) FROM table_name; 
```

## **LAST**&#x20;

The LAST function returns the last value in a set of values. It ignores NULL values.

```sql
SELECT LAST(column_name) FROM table_name;
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://qatesting.gitbook.io/qa/database-testing/sql/dml-commands/functions/aggregate-functions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
