Home >Database >Oracle >How to delete a column in oracle

How to delete a column in oracle

WBOY
WBOYOriginal
2022-01-21 14:48:1614033browse

In Oracle, you can use the ALTER statement with "DROP COLUMN" to delete the specified column. The syntax is "ALTER TABLE table name DROP COLUMN column name" or "ALTER TABLE table name DROP (column name 1, column Name 2)".

How to delete a column in oracle

The operating environment of this tutorial: Windows 10 system, Oracle 11g version, Dell G3 computer.

How to delete a column in oracle

How to delete a column in oracle:

ALTER TABLE 表名 DROP COLUMN 列名

Delete multiple columns: (It’s strange that there is no need for column, all field names are Simple field name):

     alter table 表名  drop (字段1,字段2)

Extension:

Add column

alter table t_jm_user add USR_EmailValidate CHAR(1) default 'N' not null;

Modify column

alter table t_jm_user modify USR_EmailValidate CHAR(1) default 'Y'  null;

Delete column

alter table t_jm_user drop column  USR_EmailValidate;

Add constraint

alter table user
  add constraint FK_user_CLIENT foreign key (COMP_ID)
  references T_stal (COMP_ID);

Delete constraints

alter table user drop constraint FK_user_CLIENT ;

Recommended tutorial: "Oracle Tutorial"

The above is the detailed content of How to delete a column 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