By 08/02/2016 44 Comments

Difference between TRUNCATE & DELETE in SQL

  • TRUNCATE and DELETE both statements are used to delete the data from database table(s).
  • DELETE statement deletes data from database table but it does not reset PRIMARY KEY’S auto increment indexes. These auto increment indexes remain in same state.
  • DELETE statement is used only in a situation if you have FOREIGN KEYS against¬†another table(s).
  • The type of DELETE statement is a DML.
  • The type of TRUNCATE statement is DLL.
  • TRUNCATE statement deletes data from database table quickly and faster than DELETE.
  • TRUNCATE statement deletes data from database table but it resets PRIMARY KEY’S auto increment indexes to 1 after issuing TRUNCATE statement each time.
  • TRUNCATE statement is used only in a situation if you don’t have¬†FOREIGN KEYS against¬†another table(s).
  • TRUNCATE statement can be rollback in some DBMS.

Example:

DELETE FROM tble_name;
TRUNCATE TABLE tble_name;






Posted in: Solutions

Leave your valuable Comment

Have a natural attraction for women cosmetics and replica watches uk clothes, no
more than two for men the most attractive one, is to make their own driving experience, happy and can serve as the facade of the car, another is to highlight the taste edify sentiment rolex replica watch. The replica rolex is undoubtedly the most fashionable accessories, wear a suit to attend the activities, but also get a decent match on the replica watches .