Oracle基础SQL语句

如何在建表时指定主键和外键
 
在建立表格时就指定主键和外键:
create table T_STU (
STU_ID char(5) not null,
STU_NAME varchar2(8) not null,
constraint PK_T_STU primary key (STU_ID)
);


主键和外键一起建立:
create table T_SCORE (
EXAM_SCORE number(5,2),
EXAM_DATE date,
AUTOID number(10) not null,
STU_ID char(5),
SUB_ID char(3),
constraint PK_T_SCORE primary key (AUTOID),
constraint FK_T_SCORE_REFE foreign key (STU_ID)
references T_STU (STU_ID)

)

 

oracle 添加列到指定位置

https://blog.csdn.net/liufeng_king/article/details/7421826
posted @ 2019-07-02 11:05  TangXinPing  阅读(163)  评论(0编辑  收藏  举报