Oracle ALTER Usage __oracle

Source: Internet
Author: User
If you have a string in an SQL statement that is enclosed in a single or double quotation mark, you need to be consistent in the same table, or you will see a "Row not found" error.

Use of ALTER statements the use of ALTER statements requires that the structure be modified to use an ALTER statement, as follows: The ALTER TABLE statement is used to modify the design of a table that already exists. Syntax: ALTER TABLE table add COLUMN field type[(size)] [not NULL] [CONSTRAINT index] ALTER TABLE table add CONSTRAINT multifie
Ldindex ALTER TABLE Table drop COLUMN field ALTER table Table Drop CONSTRAINT indexname Description: The table parameter specifies the name of the table to be modified.
The Add column is a reserved word for SQL that you use to add fields to the table.
Add constraint is a reserved word for SQL that you use to add an index to the table.
The drop column is a reserved word for SQL that you use to delete a field from the table.
Drop constraint is a reserved word for SQL that you use to delete the index to the table. 
field specifies the name of the field to add or remove.
The type parameter specifies the data type of the new field.
The size parameter specifies the length of the text or binary field.

The IndexName parameter specifies the name of the multiple-field index to be deleted. 
Log in to the database with a sql*plus or Third-party program that can run SQL statements: ALTER table (table name) ADD (column name data type); 
ALTER table (table name) MODIFY (column name data type);  ALTER table (table name) RENAME column (current column name) to (new column name); 
No parentheses ALTER table (table name) DROP column (column name) is required;

ALTER table (current table name) RENAME to (new table name);

such as: Alter Table employ ADD (weight number (38,0));

Alter Table employ Modify (weight number (13,2));
         Alter Table Emp Rename cloumn weight to weight_new; ALTER TABLE emp DROP COLUMN weight_new;
ALTER TABLE bouns RENAME to Bonus_new;
Add a column: ALTER table name Add (column name data type);

such as: ALTER TABLE emp ADD (weight number (38,0));
Modify the data type of a column (generally limited to modifying the length, there are many limitations when modifying to a different type): ALTER table name MODIFY (column name data type);

such as: ALTER TABLE emp MODIFY (weight number (3,0) not NULL);
Rename the column: ALTER table name RENAME column name to new column name;

such as: ALTER TABLE emp RENAME COLUMN weight to weight_new;
Deletes a column: ALTER Table name drop column column name;

such as: ALTER TABLE emp DROP COLUMN weight_new;
Rename a table: ALTER table Current table name RENAME to new table name; such as: ALTER TABLE bouns RENAME to Bonus_new ============================================================================ ======== alter user user Identifiedby ' newpassword ' REPLACE ' OldPassword ';

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.