stefanuddenberg
3/2/2020 - 2:43 AM

SQL -- Alter tables

-- Add a boolean column
ALTER TABLE table_name ADD COLUMN active boolean;

-- Remove a column
ALTER TABLE table_name DROP COLUMN active;

-- Rename a column
ALTER TABLE table_name RENAME COLUMN orig_name TO new_name; 

-- Rename the whole table
ALTER TABLE table_name RENAME TO new_table_name;