Posts

Showing posts with the label MySQL

Drop a list of MySQL tables using schema meta-data

Image
You can select tables you would like to drop from MySQL's meta schema . In this case I want to drop all tables of the user/schema user . select concat('drop table ', table_name, ';') from information_schema.tables where table_schema = 'user'; Provides following output: 'drop table booking;' 'drop table bookings;' 'drop table languages;' 'drop table report;' 'drop table reports;' 'drop table resource;' 'drop table resource_languages;' 'drop table resources;' 'drop table resources_languages;' 'drop table session;' 'drop table sessions;' 'drop table slot;' 'drop table slots;' 'drop table user;'