The Alter Command for Redshift

Here I’ll just log all the scenarios where I had to use the alter command


Rename column


Syntax:


alter table <table_name>
rename column <old column name> to <new column name>


Change the datatype


Redshift only supports changing the size of the varchar column. Every other data type change you’ll need to look for a work around.


alter table <table_name> 
alter column <column_name> type varchar(<new size>);


Change the table name


Syntax:


alter table <table_name>
rename to <new_name>;


Sources:




Enjoy Reading This Article?

Here are some more articles you might like to read next:

  • Google Gemini updates: Flash 1.5, Gemma 2 and Project Astra
  • Displaying External Posts on Your al-folio Blog
  • Can Machine Learning Help Predict Heart Disease? A Data Science Exploration
  • Predicting House Prices; MLR vs RFR
  • Predicting House Prices; SVC vs Random Forest