Because Oracle has a slightly different format for adding and deleting columns, it is hereby documented for easy viewing later.
1. Add Columns:
Sql> ALTER TABLE t1 add y integer;
Table Altered
Executed in 0.046 seconds
Description: Added column format for ALTER TABLE name add new column name data type;
2. Delete Columns
sql> ALTER TABLE t1 drop column y;
Table Altered
Executed in 0.015 seconds
Description: Delete a column separately in the format of the ALTER TABLE table name drop column name;
3. Modify Columns
sql>alter Table T1 Modify I number (10);
Description: The format of the modified column is the ALTER TABLE table name modify column name data type;
Special attention : If you want to change the column data type, you need to back up the column data before conversion, or the change will fail!
4. Renaming columns
sql> ALTER TABLE T1 rename column I to x;
Table Altered
Executed in 0.062 seconds
Description: Rename the column in the format ALTER TABLE name rename column name to new column name;
5. Delete multiple columns
Sql> ALTER TABLE t drop (A, b);
Table Altered
Executed in 1.56 seconds
Description: Delete multiple columns simultaneously in the format ALTER TABLE name drop (column name 1, column name 2,.... Column name N);
It is also important to note that deleting multiple columns at the same time does not delete all the columns in the table, and it does not make sense to delete the table.
Finally, a little bit of contempt for Oracle's developers, SQL command statement format is not standard, too casual!
Oracle Add, modify, delete, rename columns