Home  >  Article  >  Database  >  How to modify field name in oracle?

How to modify field name in oracle?

青灯夜游
青灯夜游Original
2020-08-22 12:06:109845browse

In Oracle, you can use the rename keyword to modify the field name; the syntax is "alter table table name rename column old field name to new field name;".

How to modify field name in oracle?

oracle modifies the field name

Use the rename keyword To modify the field name, the syntax is:

alter table 表名 rename column 旧的字段名 to 新的字段名;

Let’s give an example:

Create the following table

CREATE TABLE Student(
    id varchar2(32) primary key,
    name varchar2(8) not null,
    age number
);

There are A field named "name". Now if you want to change the "name" field name to "StuName", you can use the following statement

to modify the field name:

alter table Student rename column name to StuName;

Extended information: Modify field data type

Syntax:

alter table tableName modify (cloumnName 数据类型); -- 修改数据类型

Example: Still the above example

Modify data type :

alter table Student modify (id varchar2(64));

Recommended tutorial: "Oracle Tutorial"

The above is the detailed content of How to modify field name in oracle?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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