# SHOW CREATE AGGREGATE

Shows the function definition and other attributes for a user-defined aggregate function (UDAF).

## Syntax

```
SHOW CREATE AGGREGATE function_name

```

## Remarks

* Refer to the [Permissions Matrix](https://docs.singlestore.com/db/v9.1/reference/sql-reference/security-management-commands/permissions-matrix.md) for the required permissions.

## Example

The following example demonstrates how to execute a `SHOW CREATE AGGREGATE` statement for the `avg_udaf` UDAF defined in [CREATE AGGREGATE](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/create-aggregate.md).

```sql
SHOW CREATE AGGREGATE avg_udaf \G

```

```output
*** 1. row ***
           Aggregate: avg_udaf
    Create Aggregate: CREATE OR REPLACE AGGREGATE `avg_udaf` (bigint(20) NULL) RETURNS bigint(20) NULL WITH STATE record(`s` bigint(20) NULL, `c` bigint(20) NULL) INITIALIZE WITH avg_init ITERATE WITH avg_iter MERGE WITH avg_merge TERMINATE WITH avg_terminate DEFINER = 'root'@'%';
character_set_client: utf8mb4
collation_connection: utf8mb4_bin
1 row in set (0.00 sec)

```

**Related Topics**

* [CREATE AGGREGATE](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/create-aggregate.md)

***

Modified at: December 11, 2025

Source: [/db/v9.1/reference/sql-reference/procedural-sql-reference/show-create-aggregate/](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/show-create-aggregate/)

(An index of the documentation is available at /llms.txt)
