Posts tagged SQL

How to delete all rows in a MySQL or Oracle table

There are two methods:

DELETE FROM table_name

or

TRUNCATE TABLE table_name

The latter is more efficient, because it does not reference each row before deleting; it is a bulk operation. The former is expanded into DELETE * FROM table_name, which works on one row at a time. Therefore, use the latter.