Home > Database > Oracle > What is the statement to modify the table name in Oracle?

What is the statement to modify the table name in Oracle?

WBOY
Release: 2022-05-18 17:40:09
Original
12517 people have browsed it

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.

What is the statement to modify the table name in Oracle?

The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.

What is the statement used by oracle to modify the table name?

Method 1: Use ALTER to modify the table name

ALTER TABLE OLD_TABLE_NAME RENAME TO NEW_TABLE_NAME;
Copy after login

Method 2: Use RENAME to modify it Table name

RENAME OLD_TABLE_NAME TO NEW_TABLE_NAME;
Copy after login

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;
Copy after login

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;
Copy after login

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;
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template