SQL statements related to modifying the table structure in Oracle 9i

Source: Internet
Author: User

SQL statements related to modifying the table structure in Oracle 9i
1. Add a column:
Alter table table name Add (column name data type );
For example:
Alter table emp add (weight number (38,0 ));

2. Modify the Data Type of a column (generally, the length is limited. There are many restrictions when you change it to a different type)
Alter table table name modify (column name data type );
For example:
Alter table emp modify (weight number (3, 0) not null );

3. Rename the column:
Alter table table name rename column current column name to new column name;
For example:
Alter table emp rename column weight to weight_new;

4. delete a column:
Alter table Table Name drop column name;
For example:
Alter table emp drop column weight_new;

5. rename a table:
Alter table current table name Rename to new table name;
For example:
Alter table bouns Rename to bonus_new

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.