Difference between delete and truncate



Difference between delete and truncate


Distinguish, differentiate, compare and explain what is the difference between delete and truncate. Comparison and Differences.

Difference between delete and truncate

1. DELETE is a DML command while TRUNCATE is a DDL command.

2. TRUNCATE is much faster than DELETE. When the Delete operation is performed all the data gets copied into the ROLLBACK Tablespace first and then deleted. This process takes time and so it is slower. If you want to get back the deleted data, the user can ROLLBACK Tablespace. When you perform TRUNCATE operation, it removes data directly without copying it into the Rollback Tablespace. So, it is faster.

3. WHERE Clause cannot be used in TRUNCATE. But in DELETE user can write conditions using WHERE clause.

4. In DML commands like DELETE , Trigger can be  fired. But in TRUNCATE Trigger cannot be fired.

5. In a nutshell, use DELETE command to remove one or more rows from a table.  Only in a special situation, when it is required to reset a table to its initial state TRUNCATE statement is performed.



Tags:

Difference between truncate vs delete

delete vs truncate

Differences between truncate vs delete

Image Credits: Freepik

Spreading Knowledge Across the World

  • United States
  • United Kingdom
  • India
  • Nigeria
  • Philippines
  • Pakistan
  • Nepal
  • Singapore
  • Indonesia
  • Bangladesh
  • Ghana
  • United Arab Emirates
  • Kenya
  • Canada
  • Malaysia
  • Australia
  • Iran
  • South Africa
  • Uganda
  • France
  • Ireland
  • Unknown Region
  • Egypt
  • Tanzania
  • Ethiopia
  • Thailand
  • Sri Lanka
  • Cameroon
  • Hong Kong
  • Spain
  • Vietnam
  • New Zealand
  • Japan
  • Brazil
  • Saudi Arabia
  • Zambia
  • Czechia
  • Italy
  • Russia
  • Myanmar (Burma)
  • Netherlands
  • Germany
  • Romania
  • Mexico
  • Rwanda
  • Sierra Leone
  • Turkey
  • Zimbabwe
  • Poland
  • Iraq
  • Cyprus
  • Algeria
  • Liberia
  • Greece
  • Jamaica
  • Malawi
  • Qatar
  • Portugal
  • South Korea
  • Argentina
  • Colombia
  • Morocco
  • Peru
  • Kuwait
  • Lithuania
  • Finland
  • Somalia
  • Israel
  • Bulgaria
  • Chile
  • Hungary
  • Trinidad & Tobago
  • Uzbekistan
  • Ukraine
  • Sweden
  • Kazakhstan
  • Norway
  • Macedonia
  • Benin
  • Switzerland
  • Oman
  • Botswana
  • Belgium
  • Ecuador
  • Slovakia
  • China
  • Croatia
  • Brunei
  • Serbia
  • Papua New Guinea
  • Bahrain
  • Guyana
  • Denmark
  • Lesotho
  • Lebanon
  • Jordan
  • Azerbaijan
  • Latvia
  • Cambodia
  • Namibia
  • Mauritius
  • Austria
  • Mongolia
  • Albania
  • Libya
  • Gambia
  • Taiwan
  • Bhutan
  • Venezuela
  • Dominican Republic
  • Tunisia
  • Luxembourg
  • Bosnia & Herzegovina
  • Guatemala
  • Solomon Islands
  • Guam
  • Costa Rica
  • Yemen
  • Bolivia
  • and many more ...