Home > Database > Oracle > body text

How to modify table field name in oracle

hzc
Release: 2020-06-08 14:02:12
Original
7949 people have browsed it

How to modify table field name in oracle

Oracle's method to modify the table field name is:

The first method is to use the RENAME keyword:

Modify the field Name:

alter table 表名 rename column 现列zhi名 to 新列名;
Copy after login

Modify table name:

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

Add field syntax:

alter table tablename add (column datatype [default value][null/not null],….);
Copy after login

Description:

alter table 表名 add (字段名 字段类型 默认值 是否为空);
Copy after login

Example:

alter table sf_users add (HeadPIC blob);
Copy after login

Example :

alter table sf_users add (userName varchar2(30) default '空' not null);
Copy after login

Syntax for modifying fields:

alter table tablename modify (column datatype [default value][null/not null],….);
Copy after login

Description:

alter table 表名 modify (字段名 字段类型 默认值 是否为空);
Copy after login

Example:

alter table sf_InvoiceApply modify (BILLCODE number(4));
Copy after login

Syntax for deleting fields:

alter table tablename drop (column);
Copy after login

Description:

alter table 表名 drop column 字段名;
Copy after login

Example:

alter table sf_users drop column HeadPIC;
Copy after login

Renaming of fields:

Description:

alter table 表名 rename  column  列名 to 新列名   (其中:column是关键字)
Copy after login

Example:

alter table sf_InvoiceApply rename column PIC to NEWPIC;
Copy after login

Renaming of table Naming:

Description:

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

Example:

alter table sf_InvoiceApply rename to  sf_New_InvoiceApply;
Copy after login

Recommended tutorial: "Oracle Tutorial"

The above is the detailed content of How to modify table 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