The TRIM statement is used to truncate the most recent data in a table.

The general syntax is

TRIM table_name num_rows

Above statement means number of rows to be truncated.

On the other hand, the user can also specify certain number of record to be preserved with following general syntax:

TRIM table_name TO row_number
Note
Data will be permanently removed with TRIM statement, users should use this command with caution.

Examples:

To remove the last 20 rows of data in the sales table:

TRIM sales 20

To keep the first 20 rows in the sales table:

TRIM sales TO 20