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

Answer Posted / guru

1.DELETE:
- delete space allocated by mysql server and the structure of table remains same.
- used by either 'WHERE' clause or without it in mysql.
- data can be roll backed
2.TRUNCATE:
- Remove rows from mysql table but the structure of table remains same.
- The data cannot be roll backed
- can be used by only without 'WHERE' clause in mysql.
3. DROP:
- Remove whole table from mysql database.
- The data cannot be roll backed

For more details visit: http://www.phponwebsites.com/2014/01/mysql-delete-truncate-drop-difference.html

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is striped backup

1824


What is the datatype for password in mysql?

519


Does mysql case matter?

487


Can we create table in stored procedure?

488


If we use sum function in mysql, does it return sum of that row or for that column?

526






What is the phantom problem?

496


how you will show all records not containing the name "sonia" and the phone number '9876543210' order by the phone_number field.

506


What is csv?

515


How do I rename a mysql database?

490


How do I show users in mysql?

511


What is mysql installer?

496


Can mysql handle billions of records?

483


In how many ways we can retrieve the data in the result set of MySQL using PHP? What is the difference between mysql_fetch_object and mysql_fetch_array ?

530


Is mysql relational?

507


How to load data files into tables with 'mysqlimport'?

473