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

# Remove Records from an Ocient System

export const Ocient = "Ocient®";

{Ocient} supports multiple options for removing records from a database. Here, you can find the different methods for removing data along with their advantages and drawbacks to help you determine the method that best fits your needs.

<Warning>
  All options for removing data are destructive and cannot be undone after execution. Therefore, be cautious when removing any Ocient records from your database.
</Warning>

## Required Permissions

To remove data, a user must have the `DELETE` privilege for the specified table. For details on privileges, see the [Data Control Language (DCL) Statement Reference](/data-control-language-dcl-statement-reference).

## Remove Records Using DELETE

The `DELETE` SQL statement removes specific individual rows from a table based on the `WHERE` filter clause.

Unlike `TRUNCATE`, the `DELETE` statement does not restore the disk space of deleted rows without further system operations. In general, `DELETE` is a good option when removing small row sets, not entire tables.

If a `DELETE` statement has no `WHERE` filter, it removes all rows in the table.

The `DELETE` statement can support concurrent operations to remove rows on the same table, which might impact performance.

For details about the `DELETE` statement, see [DELETE FROM TABLE](/data-manipulation-language-dml-statement-reference#delete-from-table).

### Remove Data Using DELETE with a Filter

In this example, the `DELETE` statement removes all rows from the `products` table with a value less than 1 in the `rating` column.

```sql SQL theme={null}
DELETE FROM products WHERE rating < 1;
```

### Remove Data Using Joined Tables

You can use `DELETE` with a `JOIN` statement to help filter rows for removal based on a condition that applies to the second table.

<Info>
  The statement removes rows only from the first table and not the second joined table.
</Info>

This example deletes rows after performing a `JOIN` operation on the geospatial values in two tables:

* `point_table` contains a column of geospatial point values.
* `us_state_table` contains columns of all abbreviated U.S. state names and polygon values representing their boundaries.

The `JOIN` operation uses the [ST\_INTERSECTS](/spatial-relationships#st_intersects) function to evaluate if each point value in `point_table` is contained within any of the polygon values in the `us_state_table`.

The example deletes any rows in `point_table` that are within the boundaries of Texas, abbreviated as `'TX'`.

```sql SQL theme={null}
DELETE FROM point_table p
    JOIN us_state_table s ON ST_INTERSECTS(s.polygon_wkt, p.point_wkt)
WHERE s.state LIKE 'TX';
```

## Data Durability Considerations

To remove data, the data must be queryable in the system. For example, streaming data systems might experience a delay before rows can be deleted while they are in progress of the loading process to become fully durable.

In most cases, data should be loaded and queryable within a matter of seconds.

## Related Links

[Key Concepts](/key-concepts)

[Ingest Data with Legacy LAT Reference](/ingest-data-with-legacy-lat-reference)

[Query Ocient](/query-ocient)
