Mysql – Rename all tables and columns to lower case

SELECT CONCAT('ALTER TABLE', TABLE_NAME,'CHANGE`', COLUMN_NAME, '` `',
LOWER(COLUMN_NAME), '` ', COLUMN_TYPE, ';')
FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = 'your schema name'

Now execute this query and copy the output (all rows),the output itself are alter table commands.

now copy output queries/commands and execute them all at once.

 

 

Advertisements
This entry was posted in Mysql. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s