Skip to main content

Difference between DELETE and TRUNCATE

This is the common interview question for every SQL Developer and DBA position.
DELETETRUNCATE
DML (Data Manipulation Language) Command.DDL (Data Definition Language) Command.
It can be rollback.It can't be rollback.
Using DELETE we can remove some or all records from the table. We can use WHERE clause with it.Using TRUNCATE we can remove all records from the table at once. We can't use WHERE clause with it.
DELETE command is slow in performance.TRUNCATE command is super faster in performance.
All deleted Triggers fire on DELETE command.No Trigger can be fired on TRUNCATE command.
DELETE can't reset high water mark.TRUNCATE can reset high water mark.
DELETE can't release the space from the table.TRUNCATE can release the space from the table.

Comments

Popular posts from this blog

Photo : Savitri during her last days

Even after 4 decades of her death, people are very much interested to watched her (Savitri) biopic. Mahanati turned to be stupendous success. On eve of remembering Savitri, here we posted Savitri photo. The photo seems her last days. The man stand behind Savitri is Gemini Ganeshan who married Savitri. It seems that she suffered bad days during her last days.

PK Fans - Political and Private life

Pawan Kalyan fans attack Director Ram Gopal Varma's office for making parody film "Power Star" on their hero. RGV made a complaint and withdraw later for unknown reasons. 

Who killed cricket in Pakistan?

Pakistan won the 1992 WC under the leadership of one of the greatest all-rounders in the world Imran Khan. Now, he is leading the country as Prime Minister of Pakistan. Every cricket lover in the country wants to see the glory in the gentleman game after Imran became PM for Pakistan. But his leadership can’t give any assurance to other nations to play the game in Pakistan. New Zealand abandoned the historic Pakistan tour just a few minutes after the first ball was to be bowled in the first ODI in Rawalpindi. Both teams have considered this series as preparation for the ICC T20 World Cup. Kiwis cites ‘Security threat’ to its players in Pakistan. There is a question that arises why NZ came and cancelled the visit. This is a massive blow to Pakistan cricket who wants to revive the game in the country. Prime Minister Imran Khan had spoken to New Zealand Prime Minister Jacinda Ardern and informed her about the security arrangements. Pakistan Cricket Board (PCB) fumes over Black Caps decisio...