First, a few words together to understand.
alter (change) rename (rename) column (columns, to describe the columns) modify (amend) comment on (review) truncate (cut, cut)
1. Create a table
create table table (1 Field 1 Field Name Type Default (is empty), 2 Field Name Field Type Default 2);
例:create table tab_person (id varchar2(50) default sys_guid() not null, mc varchar2(20) null,createtime date null);
2. Change the name of the table
alter table table name rename to new table name;
例:alter table tab_person rename to tab_people;
rename the new table name to the table name;
例:rename tab_people to tab_person;
3. Add Field
alter table add the table name field name field type;
例:alter table tab_person add sex varchar2(2);
4. Modify field name
alter table table name rename column field name to the new field name;
例:alter table tab_person rename column sex to xb;
5. Modify Field Type
alter table table name modify (new field name field type); // add matter seemingly without parentheses
例:alter table tab_person modify xb varchar2(4);
6. Delete field
alter table drop column table name field name;
例:alter table tab_person drop column xb;
7. Add / Modify / Delete Field Description
. Comment on column table name field name is 'table illustrates'; // delete it empty assignment
Example: comment on column tab_person.mc is 'name';
8. Empty the contents of the data table
truncate table 表名;
例:truncate table tab_person;
9. Delete table
drop table 表名;
例:drop table tab_person;