Skip to content

Instantly share code, notes, and snippets.

@dtateii
Created August 25, 2016 01:19
Show Gist options
  • Save dtateii/08ff37f9087171316c933fd20b91ea59 to your computer and use it in GitHub Desktop.
Save dtateii/08ff37f9087171316c933fd20b91ea59 to your computer and use it in GitHub Desktop.
Prefix All Database Tables
SELECT Concat('ALTER TABLE ', TABLE_NAME, ' RENAME TO my_prefix_', TABLE_NAME, ';') FROM information_schema.tables WHERE table_schema = 'my_database_name'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment