Sql: Difference between truncate and delete command
Hi friends,
what is the difference between delete and trancate command
what is the difference between delete and trancate command
Replies
-
Kaustubh Katdare
Its 'truncate', I think.babloo0311Hi friends,
what is the difference between delete and trancate command -
manupepIs there any command 'delete' ?
I think 'drop table' is the command used to delete one table.
'truncate' will delete only the contents of the table . The table structure should remain. we can add datas further. -
Prasad AjinkyaWell, you can also use delete from
command to delete only the contents of the table. Schema will remain intact though. -
manupepoh! yes 'delete' is there to delete rows according to condition.
-
shalini_goel14Hi Babloo
1. TRUNCATE : You can't use WHERE clause
DELETE : You can use WHERE clause
2. TRUNCATE : You can't use WHERE clause
DELETE : You can use WHERE clause
3. Delete - delete deletes the records from table it can be rollbacked also you can give the where condiition to it.
Truncate - delete all records from table There is no rollback it always commit without giving the commit command
TRUNCATE is a DDL command and cannot be rolled back and All of the memory space is released back to the server. It can not use the Where conditions. DELETE is a DML command and can be rolled back. here can be use where conditions. TRUNCATE is much faster but don not use it if delete can work. -
babloo0311yeah thanks buddy
-
manupepoh! so much infos .Thanks shalini.
-
shalini_goel14Always welcome ๐ .
Sorry for Duplicate points:
1. TRUNCATE : You can't use WHERE clause
DELETE : You can use WHERE clause
2. TRUNCATE : You can't use WHERE clause
DELETE : You can use WHERE clause -
babloo0311yeah no probs
-
Prasad AjinkyaWow! Good tips Shalini!!
-
zia.sepsisTruncate table does not support the Where clause. In addition, the Truncate table statement does not fire a trigger. When truncate is used, the deleted rows are not entered in the transaction log. there fore it can't be rolled back. when the delete command is used , it creates a transaction log file which help you in the process of rollback.
the syntax of truncate statement is:-
truncate table table_name
the syntax of delete statement is:-
delete table_name
both the statements is used to delete all the records form the table
correct me if am wrong ๐ -
HEART-HACKERI think you got your ANS ๐
You are reading an archived discussion.
Related Posts
Happy b'day
๐๐๐๐๐
Happy birthday to CE
๐๐๐๐
๐๐
๐
waiting for CE (with new look)
hello friends iam harika...iam doing my btech 3rd yr
i need some help in selecting my mini project can any one help.......
plz its urgent
Hey guys...I am Aditya, I am studying B.tech 2nd year in electronic and communication. I've just now completed my 1st semester, but there is no practical knowledge gain..
I mean...
Dont get panic about viruses...jus try this to avoid viruses through USB..๐
AFTER YOU PLUG IN THE USB,DONT ALLOW IT TO AUTO PLAY.CLICK THE CANCEL BUTTON.
2.GO TO MY COMPUTER...
๐ can any one suggest how would it be if i make-up my mini project on spam filters (bayseian) in java language............