What are the differences between drop and truncate commands in MySQL?

Suitable Answer : DROP TABLE table_name Will DELETE the table and DATA TRUNCATE TABLE table_name Will DELETE the table DATA not the table definition ....!

More About This:
Both the above statements remove all records from the table, but the essential difference is as follows.
delete from friends – will delete all records from the friends table. That’s it. I.e. the auto_increment counter does not get reset.
truncate table friends – will delete all records from the table and also rebuild the table, thus resetting the auto_increment counter.

0 comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...