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

How to modify field name in oracle?

青灯夜游
Release: 2020-09-30 09:42:41
Original
28409 people have browsed it

Oracle method to modify the field name: use the "alter table" statement with 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?

Recommended tutorial: "Oracle Tutorial"

oracle Modify Field Name

Use the "alter table" statement with the rename keyword to modify the field name. Syntax:

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

ALTER TABLE statement is used in Add, delete or modify columns in existing tables.

The rename keyword can be used to modify table names and field names

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 is 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

1. Modify the table name

Syntax

alter table 表名 rename to  新表名
Copy after login

2. Modify the field data type

Grammar:

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

Related recommendations: php training

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