Home > Database > Oracle > body text

How to modify field name in oracle?

青灯夜游
Release: 2020-08-22 12:06:10
Original
9639 people have browsed it

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 新的字段名;
Copy after login

Let’s give an example:

Create the following table

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

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

Extended information: Modify field data type

Syntax:

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

Example: Still the above example

Modify data type :

alter table Student modify (id varchar2(64));
Copy after login

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!

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!