Oracle数据库零散知识05 -- 表创建,修改

 

1.表的创建

Create table student02(sno number);

  

2.表的删除

Drop table student02;

  

3.表的重命名

Rename student02 to student01;

  

4.表的修改

Alter table student01
--列的修改
Add ob number
Modify ob varchar2(2)
Rename column ob to obnew
Drop column obnew

--约束
Add constraint pk_student01 primary key(sno)
Add constraint uk_student01 unique (sname)
Add constraint fk_student01 foreign key(sno) references student(sno)
Add constraint ck_sno check(sno > 100)
Modify sno not null

Drop constraint fk_student01
Modify sno null;

  

5.索引

Create index ix_student01 on student01(sname);
Drop index ix_student01;

  

6.同义词

Create synonym stu01 for student01;
Drop synonym stu01;

  

 

posted @ 2015-10-31 10:32  WhyToHow  阅读(165)  评论(0编辑  收藏  举报