Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


what is the difference between TRUNCATE and DELETE command
in SQL

Answers were Sorted based on User's Feedback



what is the difference between TRUNCATE and DELETE command in SQL..

Answer / chandu

Delete:
In delete statement we can use conditions
we can roll back
we can delete parent and child table rows also
it will activate in triggers
it can be slow compare to truncate.
Truncate:
In truncate statement we cant use conditons.
we cant roll back
we can delete child table rows only.
it will not activate in triggers.
it can be fast compare to delete.

Is This Answer Correct ?    2 Yes 0 No

what is the difference between TRUNCATE and DELETE command in SQL..

Answer / dhanasekar.s

Truncate command executes faster then Delete command.
when you truncate the table we can't get back the data again
because data is removed from the memory.because ddl command
is auto commit.So we need not store any information about
deleted data in the memory.So it takes less time so faster.

But in the case of delete command is dml command.we can get
back(rollback) the data again.When you delete the data that
deleted data are stored in some where in memory that
information should be logged in the database log
information.From that information we can get the data again
easily.
So that (logging purpose) it takes time then truncate command.

It is my observation and my idea.If it is having any
mistakes please post the reason .

Thanks in Advance.

Is This Answer Correct ?    2 Yes 1 No

what is the difference between TRUNCATE and DELETE command in SQL..

Answer / tripurari

truncate id ddl command .so it can't store data into redo log files, so it can't be rollback.

Delete is dml command so it contains data into log files so it may be rollback.

Is This Answer Correct ?    1 Yes 0 No

what is the difference between TRUNCATE and DELETE command in SQL..

Answer / padmapriya

1) Delete create log files when it is deleted and occupy
more space of memory

Whereas Truncate will not create any log files and hence
much faster than delete.

2) Delete can be roll back whereas Truncate is autocommit.

3) When there is foreign key constraint even though there
is no data in child table Truncate cannot be done. only
when the constraint is dropped truncate can be executed.

Whereas though we have foreign key constraints if the child
table is deleted, then parent table can be deleted.

Is This Answer Correct ?    2 Yes 2 No

what is the difference between TRUNCATE and DELETE command in SQL..

Answer / bhupat

Truncate Statement:
1.Deletes all the rows from the table.

Delete Statement:
1.Delete a specific row.

Is This Answer Correct ?    0 Yes 0 No

what is the difference between TRUNCATE and DELETE command in SQL..

Answer / 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

what is the difference between TRUNCATE and DELETE command in SQL..

Answer / sathya

I just wanna add a point ..

while truncating a table both the structure and the datas will be removed. where as in Delete structure of the table ramains only the data in the table will be deleted.

Is This Answer Correct ?    0 Yes 0 No

what is the difference between TRUNCATE and DELETE command in SQL..

Answer / vijay rana

1.truncate is a DML command but Delete is a DDL Command

2.truncate is much faster then Delete

3.we can rollback delete but we cant rollback Truncate

4.we can not use where in truncate but we can use where with
delete

5.in case of truncate memory released immediately, but in
case of delete memory dosen release if we dont press commit.

Is This Answer Correct ?    2 Yes 4 No

what is the difference between TRUNCATE and DELETE command in SQL..

Answer / vasanth

Truncate
1.Truncate Can be DDL Command.
2.it can 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 ?    1 Yes 3 No

what is the difference between TRUNCATE and DELETE command in SQL..

Answer / akshar jain

hi every one , i want to tell that truncate can also be
rolled back,i have used that , its my practical experience
if you want further clarifications write to me at
akshar.mysore@gmail.com

Is This Answer Correct ?    12 Yes 18 No

Post New Answer

More Oracle AllOther Interview Questions

Is Oracle 7.3 is a single user or multi user..Is it possible to use this as a backend for web applications?

2 Answers  


What is the Symbol use for Inner Join

1 Answers   Oracle, TCS,


Is it possible to drop a column in a table which contains only one column? How?

1 Answers  


Where would you look for errors from the database engine?

2 Answers   Fintellix,


what is the difference b/w oracle8i and oracle9i

3 Answers   iGate,


What is mrc and what is its use? : oracle accounts receivable

0 Answers  


we have 10 concurrent programs under one request group out of 10 ccps all users submitting only 9 programs from srs window remaining one ccp for specific user how can it possible send me answer asap.

0 Answers   Accenture,


What are the interface tables used for ar invoices, customers, receipts for conversion process? : oracle accounts receivable

0 Answers  


How can you enable a trace for a session?

2 Answers  


How I can load an image into image item on Forms. I want to know about built-ins and procedure. and also code for it.

0 Answers  


A scenario for amount correction & how to use amount correction functionality in AP invoices

0 Answers  


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?

0 Answers   Punjab National Bank,


Categories
  • Oracle General Interview Questions Oracle General (1809)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (261)
  • Oracle Call Interface (OCI) Interview Questions Oracle Call Interface (OCI) (10)
  • Oracle Architecture Interview Questions Oracle Architecture (90)
  • Oracle Security Interview Questions Oracle Security (38)
  • Oracle Forms Reports Interview Questions Oracle Forms Reports (510)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (15)
  • Oracle RAC Interview Questions Oracle RAC (93)
  • Oracle D2K Interview Questions Oracle D2K (72)
  • Oracle AllOther Interview Questions Oracle AllOther (241)