The following articles mainly describe the actual application code for Oracle to use alter to modify table elements. If you are curious about the actual operation of Oracle to use alter to modify table elements, the following articles will unveil its mysteries. I hope you will gain some benefits after browsing.
Add field c
- alter table docdsp add dspcode char(200)
Delete Field
- ALTER TABLE table_NAME DROP COLUMN column_NAME
Modify Field Type
- ALTER TABLE table_name ALTER COLUMN column_name new_data_type
Rename
- sp_rename
Change the name of a user-created object, such as a table, column, or user-defined data type, in the current database.
Syntax
- sp_rename [ @objname = ] 'object_name' ,
- [ @newname = ] 'new_name'
- [ , [ @objtype = ] 'object_type' ]
Set primary key
- alter table yourtable add constraint PK_ID primary key(ID)
The above content is an introduction to Oracle's use of alter to modify table elements.