Oracle's statement to modify the table name: 1. "ALTER TABLE old table name RENAME TO new table name". This statement uses ALTER to modify the table name on the original table; 2. "RENAME old table name TO new table name" ;", this statement uses RENAME to modify the table name.
The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.
Method 1: Use ALTER to modify the table name
ALTER TABLE OLD_TABLE_NAME RENAME TO NEW_TABLE_NAME;
Method 2: Use RENAME to modify it Table name
RENAME OLD_TABLE_NAME TO NEW_TABLE_NAME;
Extended knowledge:
Create a new table using the old table data, and then delete the old table (not recommended)
create new_table as select * from old_table; drop table old_table;
Note: If the table data is large, pulling the table will be very time-consuming. Killing the old table may also affect some officially running jobs that need to call the old table, which is risky!
Use PLSQL directly to rebuild the table (not recommended)
Note: The rebuilding table function is equivalent to clearing all data, triggers, and foreign keys, and the speed will be reduced Very slow and not very efficient.
Modify the name of the column
The syntax for modifying the name of the column in the table is as follows:
ALTER TABLE table_name RENAME COLUMN column_name TO new_column_name;
For example, change the birthday column in the person table Change the name to age, as follows:
SQL> ALTER TABLE person RENAME COLUMN birthday TO age;
Recommended tutorial: "Oracle Video Tutorial"
The above is the detailed content of What is the statement to modify the table name in Oracle?. For more information, please follow other related articles on the PHP Chinese website!