Database Developer Question:

Download Job Interview Questions and Answers PDF

Tell me when are we going to use truncate and delete?

Database Developer Interview Question
Database Developer Interview Question

Answer:

TRUNCATE is a DDL command, whereas DELETE is a DML command.
We can’t execute a trigger in case of TRUNCATE whilst with DELETE, we can accomplish a trigger.
TRUNCATE is quicker than DELETE, for the reason that when we use DELETE to delete the data, at that time it store the whole statistics in the rollback gap on or after where we can get the data back after removal. In case of TRUNCATE, it will not store data in rollback gap and will unswervingly rub it out. TRUNCATE do not recover the deleted data.
We can use any condition in WHERE clause using DELETE but it is not possible with TRUNCATE.5.If a table is referenced by any foreign key constraints, then TRUNCATE won’t work.

Download Database Developer Interview Questions And Answers PDF

Previous QuestionNext Question
Explain me the SELECT INTO statement?Can you list the different type of joins?