Jump to content


Photo

Deleteing all data from table??


  • Please log in to reply
2 replies to this topic

#1 OriginalSunny

OriginalSunny
  • Members
  • PipPipPip
  • Advanced Member
  • 95 posts

Posted 12 March 2006 - 08:07 PM

Hi,
how do i delete all the data which is stored in my table??
thanks.

#2 toplay

toplay
  • Staff Alumni
  • Advanced Member
  • 973 posts

Posted 12 March 2006 - 08:55 PM

Use truncate or a delete without specifying a "where" clause. See:

[a href=\"http://dev.mysql.com/doc/refman/4.1/en/delete.html\" target=\"_blank\"]http://dev.mysql.com/doc/refman/4.1/en/delete.html[/a]

[a href=\"http://dev.mysql.com/doc/refman/4.1/en/truncate.html\" target=\"_blank\"]http://dev.mysql.com/doc/refman/4.1/en/truncate.html[/a]

FYI: You could also drop and recreate the table.



#3 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 12 March 2006 - 10:28 PM

You should be aware the TRUNCATE will reset the auto-increment counters, which DELETE will not.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users