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 is auto invoicing? Explain : oracle accounts receivable
what are the API of GL,PO,AP
What are different types of transactions in ar? : oracle accounts receivable
I need a Technical evaluation between Oracle and SAP ? please do a need ful.
can u give guidance abt packages of plsql
key flexfield structure
Difference between transaction type and transaction sources. : oracle accounts receivable
Hi, I want to know basic information about Oracle HRMS and the institutes in hyderabad or the best faculty as i want to make my career in it.And also want to know may a person from non technical background be able to do this course. Regards, Swetha
What is autocashrule set? : oracle accounts receivable
Is there any link between pr form(purchse requisition)and po form(purchase order)
My requirement is like in database some defects are present and i need to clean them.To be brief for example every employee should have active assigments.So for those records which are not having status as active or null ,i need to update the roecords using API with the correct value. Client will provide a flat file for the records whch are defected.So i need to run the API for those records (flat file)and update the data in database. So my question is how to handle this requirement.Is there any existing API for this purpose?If yes then please send me the NAME. How to update the records in the database using flatfile. Any pointer will be appreciated.Thanks in advance.
as a technical developer in oracle applications which type errors feced in your experience sofar
What is the use of transaction flexfield in autoinvoice? : oracle accounts receivable
Explain prerequisites and post activities of oracle database installation
i want to know about the javaBean.what is its purpose and how it can use in Forms.