what is the difference between TRUNCATE and DELETE command
in SQL
Answers were Sorted based on User's Feedback
Answer / guest
Truncate command cannot be rolled back while Delete can be
Is This Answer Correct ? | 178 Yes | 18 No |
Answer / pavan_1981
truncate is ddl command.its faster than delete as it doesnt
have go through the rollbacks etc.truncate being a ddl is
auto commit.we can only truncate the whole table(cant use
where clause).once table is truncated we cant rollback the
changes.when a table is truncated the memory occupied is
released.that id the water mark is adjusted.
delete is a dml command and can be rolled back.is slower
than truncate as it is dml has to go through rollback
segments etc.we can use where clause with delete.when a
table is deleted memory occupied is not released ans also
the water mark is not adjusted.
Is This Answer Correct ? | 153 Yes | 11 No |
Answer / mkjmkumar
TRUNCATE
1. It is DDL.
2. Speed is faster
3. Do not Check Constraints.
4. Roll Back is not possible.
5. Can not use where clause
DELETE
1. It is not a DDL
2. Speed is slow
3. Check constraints, If Exists then shoe error.
4. We can rollback .
5. User Where Clause
Is This Answer Correct ? | 78 Yes | 8 No |
Answer / kotravel. b
TRUNCATE DELETE
1 cannot be 1 can ba RB
roll back
2 faster than 2 slower than truncate
delete
3 it releses the stroge 3 it does not releses the stroge
sp sp
spaces
Is This Answer Correct ? | 75 Yes | 8 No |
Answer / nithya
The delete statement will result in the table spaces or
memories would remain as the current size and table
structure remain in the database. Delete is not effective
when you use it to remove all data from a table, because it
takes up storage spaces due to unclear memories.
The truncate statement will result in clearing table spaces
or memories and the table structure remain in the database.
Therefore it free table storage spaces and use it only when
you need to remove all data from a table.
Is This Answer Correct ? | 24 Yes | 3 No |
Answer / anup.wilson
hii every one ... i want to say that delite is --dml and
truncate is ddl ..nxt thing about roll back ..through
delete we roll back untill unless we are not COMMIT IT..
IF WE COMMIT AFTER DELETE ..WE CANT ROLL BACK IT
...
Is This Answer Correct ? | 15 Yes | 3 No |
Answer / dheeraj
Delete is DML Command ,Whereas Trucate is DDL command
Delete can be Rolled Back,Truncate cannot be rolled back,
Truncate is much faster then Delete
Delete will not released the memory space ,Memories would
be same if we use delete command the structure of the
table is still there
Trncate can be free the space in the meomory
Delete , use check constraints if exits then show error
Truncate don't use check constraint
Is This Answer Correct ? | 13 Yes | 4 No |
Truncate
1.Truncate Can be DDL Command.
2.it cannot be rollback.
3.we cann't use Where clause.
4.truncate=delete+commit so we cann't rollback.
5.truncate delete all record from the table.
6.truncate is a DDL command and cannot be rollbackand all
memory space is released back to server.
7.speed faster.
8.do not chcek constraint.
Delete
1.Delete Can be DML Command.
2.it can be rollback.
3.we can use Where clause.
4.delete=delete-- so we can be rollback.
5.delete delete record from the table.
6.truncate is a DDL command and can be rollback and all
memory space is not released back to server.
7.speed slow.
8. chcek constraint.
Is This Answer Correct ? | 14 Yes | 7 No |
Answer / kavita sahu
1. Truncate is a DDL command and delete is a DML command
2. Truncate delete all records from table there is no
ROLLEDBACK it always Commit without giving the Commit
3. Truncate is much faster than Delete
4. Truncate you can't use where clause
DELETE you can use where clause
Is This Answer Correct ? | 4 Yes | 0 No |
Answer / raja lakshmi reddy v
hi friends this is raja
Truncate:
1. Truncate is used to delete all rows at a time, so the
table will become as free. The user feel the table does not
contain any rows, eventhough but internally the data exist
some memory that memory is free for our reuse.
2. Truncate is faster than delete, and where clause never
possible.
3. It is ddl command so that it will not roll back because
auto commit by default.
4. in sqlserver autoid columns will reset since from
starting seed value.
Delete:
1. Delete is used to Delete particular rows or all with
where clause or without where clause.
2. remeber if u delete rows, eventhough that memory will
never free means separate memory will allocate to our table.
3. It is slower than the truncate.
4. in sqlserver autoid values will never start from seed
intial value or default value.
5. while deleting check constrains, if any problem errow
thrown.
Is This Answer Correct ? | 6 Yes | 3 No |
Why more redos are generated when the oracle database is in begin backup mode?
i am working with OC 4.5 i have numbers in table in 10 row with some null values please tell me how to find total? Thanks
how to get the values if source table & target table having duplicate values that matches the lookup condition ?(i want all duplicate match)
What view would you use to look at the size of a data file?
WHAT ALL DIFFERENT KIND OF FUNCTIONS AVAILABLE WHILE DESIGN UNIVERSES?
What is the use of transaction flexfield in autoinvoice? : oracle accounts receivable
You have just had to restore from backup and do not have any control files. How would you go about bringing up this database?
can we use lexical perameter in oracle plsql if yes how
i have marks in table,how to find total?
pl help me, i want oracle HRMS training institute address,in chennai
how to write a query without using where? Example- select * from employee where empno=10 I need to write this query without where clause.
Can we get the deleted Record again if the delete transaction has been committed.