Definition: In Oracle PL/SQL, the DELETE clause is used to remove data (rows) from a database table. The DELETE statement does not return any rows; in other words, it does not generate a result set. (You can find out how many rows were deleted, but this is not the same as a result set.)

The query above, which uses the LIKE keyword, would delete all rows where the name column contained the text 'john', as well as rows where the name column contained the text 'john smith', 'Hello john', 'mike johnson', etc.

Note that you can delete all of the rows in a table without deleting the table itself. The table structure, attributes, and indexes will still be intact even after all of the rows are removed from a table. This statement will delete all rows from the table:

However, deleting all rows from a table can be time consuming and resource intensive. In this case it is better to use the TRUNCATE (truncate) command. The TRUNCATE command is much faster than DELETE as it only alters metadata and typically does not expend any overhead enforcing constraints or firing TRIGGERs.

Our thanks to Piyush G for catching a typo on this page.Related Links: