rename db postgres code example
Example 1: rename table postgres
ALTER TABLE table_name
RENAME TO new_table_name;
Example 2: rename column postgres
ALTER TABLE customers
RENAME COLUMN name TO customer_name;
ALTER TABLE customers
RENAME COLUMN phone TO contact_phone;
Example 3: postgres rename database
ALTER DATABASE "old_dbname" RENAME TO "new_dbname"
Example 4: rename column postgres
ALTER TABLE distributors RENAME COLUMN address TO city;