Skip to content

Instantly share code, notes, and snippets.

@CyJimmy264
Created September 24, 2014 07:15
Show Gist options
  • Save CyJimmy264/de6ac80f5ccad38e1e4a to your computer and use it in GitHub Desktop.
Save CyJimmy264/de6ac80f5ccad38e1e4a to your computer and use it in GitHub Desktop.
Drop all tables that start with some prefix
SELECT
CONCAT(
"DROP TABLE ",
GROUP_CONCAT(
CONCAT(TABLE_NAME, "\n")
)
) AS stmt
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = "DatabaseName" AND TABLE_NAME LIKE "prefix_%"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment