A DIFFERENCE BETWEEN DELETE AND TRUNCATE IN SQL
Abstract & Details
Research Area
Computer Engineering
Keywords
DDL
DML
DQL
DCL
TCL
Abstract
While working with the database we often need to delete data, sometimes to create more space, sometimes just remove all data to make table ready for next day's transaction or sometimes just selectively remove stale data. SQL provides a couple of handy commands to remove data e.g. truncate, delete and drop. The last one is bit different because instead of removing data it just deletes table. What is the difference between truncate and delete command in SQL or when to use truncate vs delete is one of the most frequently asked SQL interview question? Knowledge of this critical command is not only useful for interviews, but also while working with a big database with a large number of records, especially while writing SQL scripts for purging transaction databases. An Incorrect choice of SQL command can result is either very slow processor can even blow up the log segment; if too much data needs to be removed and log segment is not enough. That's why it's critical to know when to use truncate and delete command in SQL. In this paper, we will first see few differences between them, and based upon them, you should be able to find out when DELETE is a better option for removing data or TRUNCATE should be used to purge tables.
License
This work is licensed under a Creative
Commons
Attribution-ShareAlike 4.0 International License.
Author Information
| # | Name | Institute / Affiliation |
|---|---|---|
| 1 | Brijesh Patel | S.B. Polytechnic |
| 2 | Jigisha Trivedi | S.B.POLYTECHNIC |
How to Cite
Use the following formats to cite this article in your research.
APA Style
Patel, Brijesh & Trivedi, Jigisha (2018). A DIFFERENCE BETWEEN DELETE AND TRUNCATE IN SQL. International Journal of Advance Research and Innovative Ideas In Education, 4(6), 37-43.
MLA Style
Patel, Brijesh, and Jigisha Trivedi. "A DIFFERENCE BETWEEN DELETE AND TRUNCATE IN SQL." International Journal of Advance Research and Innovative Ideas In Education, vol. 4, no. 6, 2018, pp. 37-43.
IEEE Style
Brijesh Patel and Jigisha Trivedi, "A DIFFERENCE BETWEEN DELETE AND TRUNCATE IN SQL," International Journal of Advance Research and Innovative Ideas In Education, vol. 4, no. 6, pp. 37-43, 2018.
Vancouver Style
Patel Brijesh, Trivedi Jigisha. A DIFFERENCE BETWEEN DELETE AND TRUNCATE IN SQL. International Journal of Advance Research and Innovative Ideas In Education. 2018;4(6):37-43.
Harvard Style
Patel, Brijesh & Trivedi, Jigisha (2018) 'A DIFFERENCE BETWEEN DELETE AND TRUNCATE IN SQL', International Journal of Advance Research and Innovative Ideas In Education, 4(6), pp. 37-43.
Chicago Style
Patel, Brijesh and Jigisha Trivedi. "A DIFFERENCE BETWEEN DELETE AND TRUNCATE IN SQL." International Journal of Advance Research and Innovative Ideas In Education 4, no. 6 (2018): 37-43.
Turabian Style
Patel, Brijesh and Jigisha Trivedi. "A DIFFERENCE BETWEEN DELETE AND TRUNCATE IN SQL." International Journal of Advance Research and Innovative Ideas In Education 4, no. 6 (2018): 37-43.
Related Research
EduQuest AI: A Gamified Learning Platform for Interactive and Personalized Digital Education
Download PDF
Distributed Real-Time Stream Analytics and Ingestion Engine for High-Velocity Big Data Architectures
Download PDF