Web Hosting Talk







View Full Version : MySQL tables


MarieQ
11-15-2000, 05:24 PM
I have a mysql database with 5000 tables. I need to delete those tables with 5 rows or less (delete if table contains <=5 records)

I know how to delete a table:
DROP TABLE IF EXISTS mytable001;

but I don't know how to delete tables "globally".
I'm using phpmyadmin.

Any info appreciated.

Travis
11-16-2000, 12:04 AM
This could be done with just a little bit of PHP code, but I don't know of any way to do it with just SQL.

Anybody?

MarieQ
11-16-2000, 07:49 AM
I will try with some PHP code
I think it can't be done just with SQL

Something like:

while not(all tables processed) do
{
process(table)
next table
}

process()
{
if table has <=5 rows : drop table
}

Travis
11-16-2000, 04:41 PM
Yep, that's the basic idea. If you need any help, let me know.