To remove records from a table without removing the table itself, use the DELETE or trUNCATE TABLE statement. Either of the following statements completely empties the named table: DELETE FROM t; TRUNCATE TABLE t; DELETE takes an optional WHERE clause that identifies which records to remove. This is useful when you want to delete only a given subset of records from a table. The following statement removes only those records from t that have a status column value of 'expired': DELETE FROM t WHERE status = 'expired'; DELETE and trUNCATE TABLE are discussed further in Section 11.5, "The DELETE and TRUNCATE TABLE Statements," where you can find a comparative breakdown of their operational characteristics. |