what is the difference between TRUNCATE and DELETE command
in SQL
Answer Posted / priya
Truncate an Delete both are used to delete data from the table. These both command will only delete data of the specified table, they cannot remove the whole table data structure.Both statements delete the data from the table not the structure of the table.
TRUNCATE is a DDL (data definition language) command whereas DELETE is a DML (data manipulation language) command.
You can use WHERE clause(conditions) with DELETE but you can't use WHERE clause with TRUNCATE .
You cann't rollback data in TRUNCATE but in DELETE you can rollback data.TRUNCATE removes(delete) the record permanently.
A trigger doesn’t get fired in case of TRUNCATE whereas Triggers get fired in DELETE command.
If tables which are referenced by one or more FOREIGN KEY constraints then TRUNCATE will not work.
TRUNCATE resets the Identity counter if there is any identity column present in the table where delete not resets the identity counter.
Delete and Truncate both are logged operation.But DELETE is a logged operation on a per row basis and TRUNCATE logs the deallocation of the data pages in which the data exists.
TRUNCATE is faster than DELETE.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What are different types of transactions in ar? : oracle accounts receivable
How would you determine who has added a row to a table?
What is the importance of batch source set up in ar? : oracle accounts receivable
please send me oracle pl/sql exp resume. and also faqs...
I've got a database 10g and Form version 5.0 but unable to connect. Does Oracle 10g database supports form 4.5
WHAT ALL DIFFERENT KIND OF FUNCTIONS AVAILABLE WHILE DESIGN UNIVERSES?
Tell me about entire study of finacle software as soon as possible? give me the idea about questions which coulb be asked in interview of pnb it officers?
TILL WHAT LEVEL OF SECURITY BO SUPPORTS?
which gives Oracle R12 Financial training in delhi please give me answer its urgent?
What is an Oracle database Partial Backup?
now iam working as an hr executive in hyderabad i would like to learn oracle hrms kindly suggest me some good institutes in hyderabd
What are the different tools available for hot backups in Oracle? Is it preferable to take it manually all the time or it depends on the size of the database?
I would like to study certification course in Data base adminidtrator then where would i go to study this course?
Why more redos are generated when the oracle database is in begin backup mode?
I am Bsc Computer Science Graduate, I have good knowledge in SQL 7.0, Can I go for Oracle APPS course please suggest me the answer