|
Home > Archive > MySQL Server Forum > August 2005 > Delete table data completely
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Delete table data completely
|
|
| Jacky Luk 2005-08-26, 3:23 am |
| Hi,
I can't seem to find a way to delete all records of a table. I created my
tables in MySQL Query Browser, then fill them up with VC++, but some records
were incorrect, And I had to recreate the table again. So please help, I
just wanted to delete the records rather than dropping the table completely
and start over again..
Thanks
Jack
| |
| Jonathan 2005-08-26, 3:23 am |
| Jacky Luk wrote:
> Hi,
> I can't seem to find a way to delete all records of a table. I created my
> tables in MySQL Query Browser, then fill them up with VC++, but some records
> were incorrect, And I had to recreate the table again. So please help, I
> just wanted to delete the records rather than dropping the table completely
> and start over again..
> Thanks
> Jack
If you would really like to start over agian than the best way is to
drop the table, as this way the autonumber index will start from scratch.
Else use the delete command (http://dev.mysql.com/doc/mysql/en/delete.html)
I believe the following should work:
DELETE FROM TABLE 'tablename'
Jonathan
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
| |
| Hubert Thumfart 2005-08-30, 7:23 am |
| Jacky Luk wrote:
> Hi,
> I can't seem to find a way to delete all records of a table. I created my
> tables in MySQL Query Browser, then fill them up with VC++, but some
> records were incorrect, And I had to recreate the table again. So please
> help, I just wanted to delete the records rather than dropping the table
> completely and start over again..
> Thanks
> Jack
truncate 'tablename'; // delete all records from table fast
optimize table 'tablename'; // and free diskspace of the table for
// faster new inserts
Hubert
|
|
|
|
|