postgresqlHow do I rename a table in PostgreSQL?
Renaming a table in PostgreSQL is done using the ALTER TABLE
command. This command allows you to change the name of the table as well as other properties. Here is an example of how to rename a table:
ALTER TABLE old_table_name RENAME TO new_table_name;
This command will rename the table old_table_name
to new_table_name
.
The command consists of the following parts:
ALTER TABLE
- This is the command to alter the table.old_table_name
- This is the name of the table to be renamed.RENAME TO
- This clause indicates that the table is to be renamed.new_table_name
- This is the new name of the table.
For more information, please refer to the PostgreSQL documentation.
More of Postgresql
- How can I troubleshoot zero damaged pages in PostgreSQL?
- How can I use PostgreSQL with YAML?
- How can I use PostgreSQL and ZFS snapshots together?
- How do I use PostgreSQL's XMIN and XMAX features?
- How can I use PostgreSQL's "zero if null" feature?
- How can I use PostgreSQL with Zabbix?
- How can I use PostgreSQL XOR to compare two values?
- How do I use PostgreSQL ZonedDateTime to store date and time information?
- How can I extract the year from a date in PostgreSQL?
- How do I convert a string to lowercase in PostgreSQL?
See more codes...