SQL BASIC

DB2 SQL 103 DML : DELETE and TRUNCATE


SQL DELETE is quite straightforward.

DELETE FROM TABLENAME WHERE COLUMN1='X' and COLUMN2='Y'


There is one more SQL statement to delete records from a table and that is SQL TRUNCATE TABLE statement.

TRUNCATE TABLE table-name

Difference between DELETE and TRUNCATE:

  1. TRUNCATE statement has no WHERE clause. So it will delete all the records of table.
  2. By default ,TRUNCATE statement does not call any DELETE TRIGGERS(IGNORE DELETE TRIGGERS).

IBM i developer.

View Comments
There are currently no comments.