Skip to content

Instantly share code, notes, and snippets.

@iangow
Created July 29, 2016 18:05
Show Gist options
  • Save iangow/958a705f6258180aa3f542951ddf6f7f to your computer and use it in GitHub Desktop.
Save iangow/958a705f6258180aa3f542951ddf6f7f to your computer and use it in GitHub Desktop.
Change order of columns in PostgreSQL
CREATE TABLE tone_data_temp AS
SELECT file_name, last_update, category, word_count, litigious,
positive, uncertainty, negative, modal_strong, modal_weak
FROM bgt.tone_data;
DROP TABLE bgt.tone_data;
ALTER TABLE tone_data_temp RENAME TO tone_data;
ALTER TABLE tone_data SET SCHEMA bgt;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment