The following article describes how to modify an Oracle table column, including how to add a column and how to modify the column definition, as well as the specific operations in the Process of deleting the column, the specific content of the article is described below.
1. Add Columns
- ALTER TABLE table_name ADD
( column datatype [DEFAULT EXPR][,column datatype...]);
For example:
- SQL>ALTER TABLE emp01 ADD eno NUMBER(4);
2. Modify column Definitions
For example:
- SQL>ALTER TABLE emp01 MODIFY job VARCHAR2(15)
- DEFAULT 'CLERK'
3. Delete Columns
For example:
- SQL> ALTER TABLE emp01 DROP COLUMN dno;
4. Modify the column name
For example:
- SQL>ALTER TABLE emp01 RENAME COLUMN eno TO empno;
5. Modify the table name
For example:
- SQL>RENAME emp01 TO employee;
6. Add comments
For example:
SQL> COMMENT ON TABLE employee IS 'employee information ';
SQL> COMMENT ON TABLE employee. name IS 'employee name ';
The above content is an introduction to the modification of Oracle table columns. I hope you will have some gains.