> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firebolt.io/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.firebolt.io/feedback

```json
{
  "path": "/reference-sql/functions-reference/aggregation/hash-agg",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

> Reference material for HASH_AGG

# HASH_AGG

Calculates a hash value over all rows on a list of arguments. When `*` is specified as an argument - calculates a hash aggregation over all columns in the input. Performing a hash aggregation operation is useful for warming up table data or to check if the same values exist in two different tables.

**Alias:** `CHECKSUM`

## Syntax

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
HASH_AGG( <expression1> [, <expression2>] [, <expression3>] [, ...<expressionN>] ) [FILTER ([WHERE] <condition>)]
HASH_AGG(*) [FILTER ([WHERE] <condition>)]
```

## Parameters

| Parameter      | Description                                                                     | Supported input types |
| :------------- | :------------------------------------------------------------------------------ | :-------------------- |
| `<expression>` | A column name for specific results for the `HASH_AGG` function to be applied to | Any `<column>` name   |
| `<condition>`  | An optional boolean expression to filter rows used in aggregation               | `BOOL`                |

## Return Type

`BIGINT`

## Examples

**Example**

The following code example creates a new table `tournament_information`:

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
CREATE DIMENSION TABLE tournament_information (name TEXT, prizedollars DOUBLE PRECISION, tournamentid INTEGER);

INSERT INTO
	tournament_information
VALUES
	('The Snow Park Grand Prix', 20903, 1),
	('The Acceleration Championsip', 19274, 2),
	('The Acceleration Trials', 13877, 3)
```

**Example**

The following code example calculates a hash aggregation based on all columns in the table `tournament_information`:

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT HASH_AGG(*) FROM tournament_information;
```

**Returns**

`1,889,915,309,908,437,919`

The next example calculates a hash aggregation based on columns `prizedollars` and `tournamentid` only.

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT HASH_AGG(prizedollars, tournamentid) FROM tournament_information;
```

**Returns**

`3,058,600,455,882,068,351`
