Use of alter constaints to modify the table structure in ORACLE, alterconstaints

Source: Internet
Author: User

Use of alter constaints to modify the table structure in ORACLE, alterconstaints

1. Create a federated primary key

Alter table name add constraints end name primary key (column name, column name ..);

2. New Characters

Alter table name ADD (column datatype [default value] [NULL/not null]);

3. Delete Columns

Alter table Name DROP (COLUMN) J;

4. Modify Table characters

Alter table name MODIFY (column datatype [default value] [NULL/not null])


What table of oracle data needs to be changed using the alter command?

The alter command is used to change the table structure rather than data. DDL Data Definition Language

Change the table structure of the Oracle database in the program

Modify Table Name:
Alter table name rename to new name
Add field:
Alter table name add field Name field type
Delete field:
Alter table Name drop column field name
Modify Field:
Alter table name rename column Original Field name to new name;

Modify the field type (prerequisite: no data in the table)
Alter table name modify Field name new type;
Example: String deleteColumn = "alter table t_user drop column sname ";

Hope to help you!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.