what is difference between delete and truncet ?

Answer Posted / nitin bisht

Delete : A delete statement deletes the data from a table. A
delete statement can have a where clause, on which it
deletes the records that satisfy only the “where” condition.
If the
“where” condition is omitted the delete statement deletes
all the records in a table.

Actions of Delete statement :

* deletes the data from the current table space
* Modifies the undo tablespace with the delete records.
* Executes all the before / after statement and row
level triggers.
* Updates the indexes (makes the index empty if the
where clause is omitted).
* Constraint checks are performed before deleting the rows

.

Syntax of a delete Statement:

DELETE FROM table [WHERE condition]

Truncate : Truncate drops all the records in a table . But
as it is a DDL statement data cannot be retrieved. Usually
truncate is faster than delete statement becuase there is no
need to change or update the UNDO tablespace with the
deleted records. Truncate is an implict commit
Statement.Truncate statement deallocates the space.

Actions of Truncate Statement:Removes all the records from
the current tablespace.

* Updates the indexes.
* High watermark of the truncated table is reset.
* Integrity Constraint checks are performed

Syntax of a Truncate Statement:

TRUNCATE TABLE table_NAME ;

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a super key?

708


what is the full procedure for using store procedure in informatica7.1?

1901


What is database schema name?

651


What is the database url?

620


You are creating a Index on EMPNO column in the EMPLOYEE table. Which statement will you use?

872






What is a database string?

600


Which is the most reliable programming language for RDBMS Relational Database Management System for Multi user applicaton. For PC application or web application ?

2135


What are indexes in oracle?

728


What is ole db source in ssis?

637


how to configure oracle 10g in java1.5 and tell me know how to set class path in system?

1674


What are the validations performed on the source data? If there are junk data available in the source data, how to eliminate it?

1663


can we delete autodiff back up that we have set through sql server agent.

1833


What is the use of graph database?

642


What is the purpose of firebase?

629


how to send multiple records which matches all the condition in the lookup transformation ? (if lookup matches the codition for duplicate values)

1694