# DROP AGGREGATE

The `DROP AGGREGATE` command removes a single user-defined aggregate function (UDAF) from the specified database.

## Syntax

```
DROP AGGREGATE [IF EXISTS] {function_name | database_name.function_name} [FORCE]

```

## Remarks

* Only one function can be removed using the `DROP AGGREGATE` command.
* If `DROP AGGREGATE` is executed for a function that does not exist, the following error will occur:
  ```sql
  DROP AGGREGATE myaggregate;

  ```
  ```output

  ERROR 2219 (HY000): Function 'db1.myaggregate' doesn't exist

  ```
  However, if the `IF EXISTS` clause is used and the function does not exist, no error will occur:
  ```sql
  DROP AGGREGATE IF EXISTS myaggregate;

  ```
  ```output

  Query OK, 0 rows affected (0.00 sec)

  ```
* Specify the `FORCE` option to remove an aggregate function (UDAF) created by an [Extension](https://docs.singlestore.com/db/v9.1/reference/sql-reference/procedural-sql-reference/extensions.md). You must have the `DROP EXTENSION` permission to use this option.
* This command causes implicit commits. Refer to [COMMIT](https://docs.singlestore.com/db/v9.1/reference/sql-reference/data-manipulation-language-dml/commit.md) for more information.

## Examples

**Dropping a Function in the Current Database**

The following example removes an existing function from the current database.

```sql
SHOW AGGREGATES;

```

```output

+-------------------+
| Aggregates_in_db1 |
+-------------------+
| multiply_hundred  |
| myaggregate       |
+-------------------+
2 rows in set (0.00 sec)

```

```sql
DROP AGGREGATE myaggregate;

```

```output

Query OK, 0 rows affected (0.05 sec)
```

```sql
SHOW AGGREGATES;

```

```output

+-------------------+
| Aggregates_in_db1 |
+-------------------+
| multiply_hundred  |
+-------------------+
1 row in set (0.00 sec)
```

**Dropping a Function in Another Database**

The following example removes an existing function while connected to another database in your SingleStore cluster.

```sql
USE db1;

SHOW AGGREGATES;

```

```output

+-------------------+
| Aggregates_in_db1 |
+-------------------+
| multiply_hundred  |
| myaggregate       |
+-------------------+
2 rows in set (0.00 sec)

```

```sql
USE db2;

DROP AGGREGATE db1.myaggregate;

```

```output

Query OK, 0 rows affected (0.05 sec)
```

```sql
USE db1;

SHOW AGGREGATES;

```

```output

+-------------------+
| Aggregates_in_db1 |
+-------------------+
| multiply_hundred  |
+-------------------+
1 row in set (0.00 sec)
```

***

Modified at: June 11, 2026

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

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