Created
November 4, 2019 20:12
-
-
Save emafriedrich/ddd93c1988b885764b5098d8a75526bc to your computer and use it in GitHub Desktop.
This command generate the commands for rename all table names from a database to another database schema.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT CONCAT('RENAME TABLE ',table_schema,'.',table_name, | |
' TO ','new_database_name',table_name,';') | |
FROM information_schema.TABLES | |
WHERE table_schema LIKE 'old_database_name'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment