WordPress plugin: WooCommerce

WooCommerce banner

Delete WooCommerce's tables after uninstalling WooCommerce

-- set table schema and pattern matching for tables
SET @schema = 'bitnami_wordpress';
SET @pattern = 'wp_woocommerce_%';
-- SET @pattern = 'wp_wc_%';

-- build dynamic sql (DROP TABLE tbl1, tbl2...;)
SELECT CONCAT('DROP TABLE ',GROUP_CONCAT(CONCAT(@schema,'.',table_name)),';')
INTO @droplike
FROM information_schema.tables
WHERE @schema = database()
AND table_name LIKE @pattern;

-- display the dynamic sql statement
SELECT @droplike;

-- execute dynamic sql
PREPARE stmt FROM @droplike;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;