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

Where’s database data actually stored? Is there a way to see the files which are stored?

763


What are features of mysql?

684


What is pragma autonomous_transaction?

664


How to drop an existing table in mysql?

759


what is the difference between gui testing and database testing? : Mysql dba

738


Can we join 3 tables in mysql?

724


What are the benefits of mysql?

727


How do I assign a variable in mysql?

711


why not null is not allowed at table level

2537


Hi Team, This is kartik, I recently completed my B-tech. Importance of posting this question is for to know the best books on SQL(MYSQL/Oracle)? I like SQL concept's so much, at the same time i decided to choose SQL for my career purpose. So please suggest me the best books that are very helpful for a fresher to improve concepts like (SQL/PLSQL)Basics, programming concepts, architectures etc. Please consider my request as an important one. I am very thankful to you for providing this opportunity. If possible can you please send the names of books for my personal id also: karthikgdv1206@yahoo.com. Thanks, Kartik T

1996


What is the difference between mysql_fetch_assoc and mysql_fetch_array?

747


Does insert statement lock the table?

723


How do I start mysql client?

739


How do I delete a table in mysql workbench?

763


Is mysql same as mariadb?

689