arrow_backwardBack to Amazon Redshift code examples

Amazon Redshift Alter Column Default Example

How to change a column's default value in Amazon Redshift
A common example for a created_at column - setting the default to the time that the record was created
ALTER TABLE
  "users"
ALTER COLUMN
  "created_at"
SET
  DEFAULT GETDATE()
Making the default value static
ALTER TABLE
  "users"
ALTER COLUMN
  "first_name"
SET
  DEFAULT 'Mateo'

Using Beekeeper Studio?

Beekeeper Studio is a free and open source database manager for Windows, Mac, and Linux.

This feature is baked right in, so there's no need to manually type SQL every time. Access column editing by right-clicking on a table in the sidebar and clicking 'View Structure'.

Download Beekeeper Studio