PDA

View Full Version : How to delete mysql tables


stahler
07-23-2003, 05:58 AM
Hi folks, being somewhat of a newbie, how do you delete tables from the mysql client?

Help appreciated

PhilG
07-23-2003, 07:41 AM
Oh, oh, I can answer this one :-)

It can be done very simply by using the following syntax:

DROP [TEMPORARY] TABLE [IF EXISTS] tbl_name [, tbl_name,...] [RESTRICT | CASCADE]

Here is an example:

DROP TABLE IF EXISTS mytable;

Be careful though as any data in mytable (change this to the name of your own table) will be removed permanently!

Here is a link to official documentation:
http://www.mysql.com/doc/en/DROP_TABLE.html

stahler
07-23-2003, 02:15 PM
Thanks for the reply

MrMike
08-03-2003, 11:40 AM
huh, I had totally forgotten about the IF EXISTS option... silly me :)

PhilG
09-03-2003, 12:23 PM
Yeah, its handy at times.

Actually looking back at this I do not even know what the [RESTRICT | CASCADE] is used for... Anyone know what its for?

raster
10-31-2003, 04:17 PM
can we distribute data in my sql