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

How to modify table field name in oracle

hzc
hzcOriginal
2020-06-08 14:00:177861browse

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 新列名;

Modify table name:

alter table 表名 rename to 新表dao名

Add field syntax:

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

Description:

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

Example:

alter table sf_users add (HeadPIC blob);

Example :

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

Syntax for modifying fields:

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

Description:

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

Example:

alter table sf_InvoiceApply modify (BILLCODE number(4));

Syntax for deleting fields:

alter table tablename drop (column);

Description:

alter table 表名 drop column 字段名;

Example:

alter table sf_users drop column HeadPIC;

Renaming of fields:

Description:

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

Example:

alter table sf_InvoiceApply rename column PIC to NEWPIC;

Renaming of table Naming:

Description:

alter table 表名 rename to  新表名

Example:

alter table sf_InvoiceApply rename to  sf_New_InvoiceApply;

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!

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