Oracle to create the table:
create table 表名 (
Field Name Field Type 1 if the default value is empty,
Field Name Field Type 2 if the default value is empty,
Field Name Field Type 3 if the default value is empty,
......
);
Create a user table:
create table user (
id number(6) primary key, ---主键
name varchar (50) not null, --- name is not null
sex varchar2 (6) default 'male' check (sex in ( 'male', 'female')) --- sex default 'male'
);
Modify the table name:
rename the old table to the new table name;
rename user to newuser;
Oracle delete table:
delete from 表名;
Delete to delete the data is a one of the deleted data, where conditions can be added later, without deleting the table structure. Note: If the table has generated identity increment id column, after delete from still increased from the previous number.
truncate table 表名;
truncate disposable delete all data, without deleting the table structure. Note: If the table has generated identity increment id column, after truncate, will restore the original value.
drop table 表名;
drop delete all data will be deleted table structure.
Oracle modify the table:
Add new field:
alter table table add (Type Default Value field name field is empty);
alter table user add(age number(6));
alter table user add (course varchar2(30) default '空' not null);
Modify the field:
alter table table name modify (Field Type Default name field is blank);
alter table user modify((age number(8));
Modify field names:
alter table table name rename column column column name to the new name;
alter table user rename column course to newcourse;
Delete field:
alter table drop column table name field name;
alter table user drop column course;