What are the differences between drop a table and truncate
a table?

Answer Posted / soumik

1.DELETE table will result into deletion of data from the
table without affecting the table structure. But since
delete statement is a DML(Data Manipulation Language)
statement, it directly dosnt reflect the database. In other
words, the deleted data will be stored in a separate
tablespace called UNDO tablespace(which takes up memory)
that can be retrieved by using a ROLLBACK statement.

2. DROP table results into loss of data and structure both
which cannot be retrieved. Drop statement is DDL(Data
Definition Language) which is AUTO-COMMIT.

3. TRUNCATE table will clear the data from the table only
without affecting the table structure. Data cannot be
retrieved after executing this statement as well, since it
an AUTO-COMMIT statement. Truncate is also a DDL statement.

Is This Answer Correct ?    9 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is auto increment in mysql?

762


How to connect html form to mysql database using php?

717


What are features of mysql?

684


What is database in php mysql?

724


How to display nth highest salary from a table in a mysql query?

773


Explain triggers and stored procedures?

708


How many columns can be used for creating Index?

781


How does mysql clustering work?

694


What is data types in mysql?

696


What is inner join in mysql?

685


What is pdo connection?

662


Why phpmyadmin is used for mysql?

712


what is the default port for mysql server? : Mysql dba

779


How to delete the repeated records from a table?

714


Why use mysql procedures?

741