rename column postgresql code example

Example 1: postgresql add column with constraint

ALTER TABLE customers 
ADD COLUMN contact_name VARCHAR NOT NULL;

Example 2: rename table postgres

ALTER TABLE table_name
RENAME TO new_table_name;

Example 3: how to update column name in psql

ALTER TABLE table_name
  RENAME COLUMN old_name TO new_name;

Example 4: psql filed name alter

ALTER TABLE table_name 
RENAME column_name TO new_column_name;

Example 5: rename column postgres

ALTER TABLE customers 
RENAME COLUMN name TO customer_name;

ALTER TABLE customers
RENAME COLUMN phone TO contact_phone;

Example 6: how to update column name in psql

ALTER TABLE order_details
  RENAME TO order_information;

Tags:

Html Example