Skip to content

Instantly share code, notes, and snippets.

@hevertonfreitas
Created May 26, 2017 17:21
Show Gist options
  • Save hevertonfreitas/077e847d62e60015c4ee1196f5346f5f to your computer and use it in GitHub Desktop.
Save hevertonfreitas/077e847d62e60015c4ee1196f5346f5f to your computer and use it in GitHub Desktop.
Rename Columns
SELECT CONCAT_WS(' ', 'ALTER TABLE', table_name, 'CHANGE', column_name, 'new_name DATETIME;')
FROM information_schema.columns
WHERE table_schema = 'database' AND column_name = 'old_name';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment